@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@700;800&display=swap');

/* ✅ Base Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  scrollbar-width: thin;
  scrollbar-color: #5e2b94 #1a1a1a;
}

body {
  background-color: #111;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* 🔮 Glowing Banner Upgrade - Full Screen Width */
.banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #2b084e 0%, #4b127a 50%, #2b084e 100%);
  width: 100%;                   /* 👈 Spans full width edge-to-edge */
  padding: 1.2rem 8%;            /* 👈 Brings the logos in from the ends */
  color: #fff;
  border-bottom: 2px solid rgba(252, 176, 69, 0.4);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fcb045;
  box-shadow: 0 0 14px rgba(252, 176, 69, 0.45), 0 4px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(252, 176, 69, 0.7);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-text {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 3.2rem;
  font-weight: 800;
  color: #fff8f0;
  text-align: center;
  margin: 0 1.5rem;
  line-height: 1.1;
  letter-spacing: 0.5px;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.7), 0 0 24px rgba(252, 176, 69, 0.35);
}

/* ✅ Main Layout */
#main-wrapper {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 2rem;
  width: 100%;
  max-width: 1400px;
  padding: 2rem;
}

/* ✅ Sidebar */
#sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #1a1a1a;
  border-radius: 10px;
  padding: 1rem;
  min-width: 220px;
  max-width: 240px;
}

/* ✅ Dropdown Block */
.dropdown-block {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  max-width: 900px;
  margin: 2rem auto;
}

/* ✅ Refined Dropdown Styling */
.selector-group {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  margin: 0 auto 1.5rem;
  padding: 0.5rem 1rem;
  background-color: #1a1a1a;
  border-radius: 8px;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.05);
  max-width: 320px;
  width: 100%;
}

.selector-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #b88de6;
  margin-bottom: 0.4rem;
  letter-spacing: 0.5px;
}

.selector-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  background-color: #2a2a2a;
  color: #eee;
  border: 1px solid #5e2b94;
  border-radius: 6px;
  transition: border-color 0.2s ease;
}

.selector-group select:focus {
  outline: none;
  border-color: #b873ff;
  background-color: #333;
}

/* ✅ Character Info */
.character-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 1rem;
}

.dynamic-avatar img {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  border: 3px solid #fff;
  object-fit: cover;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

#character-name {
  margin-top: 0.5rem;
  font-weight: bold;
  font-size: 1rem;
  color: #b88de6;
}

/* ✅ Chat Area */
#app-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #1a1a1a;
  width: 100%;
}

#chat-container {
  padding: 2rem;
  width: 100%;
}

.chat-panel {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

/* ✅ Chat Window */
#chat-window {
  background-color: #222;
  border-radius: 10px;
  padding: 1rem;
  height: 400px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

/* ✅ Message Styling */
.message-box {
  padding: 0.7rem 1rem;
  margin-bottom: 0.6rem;
  border-radius: 10px;
  font-size: 0.95rem;
  max-width: 60%;
  word-wrap: break-word;
  color: #fff;
}

.user {
  background-color: #5a189a;
  margin-left: auto;
  text-align: left;
}

.ai.kate {
  background-color: #228B22;
  margin-right: auto;
  text-align: left;
}

.ai.beryl {
  background-color: #5D8AA8;
  margin-right: auto;
  text-align: left;
}

/* ✅ Labels */
.user-label, .ai-label {
  font-weight: bold;
  color: #b873ff;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  display: block;
}

.user-label {
  text-align: right;
  margin-right: 0.5rem;
}

.ai-label {
  text-align: left;
  margin-left: 0.5rem;
}

/* ✅ Chat Input */
#chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
}

#user-input {
  flex: 1;
  padding: 0.5rem;
  border-radius: 5px;
  border: none;
  resize: none;
  font-size: 1rem;
}

button[type="submit"] {
  background-color: #b873ff;
  border: none;
  color: white;
  padding: 0 1rem;
  border-radius: 5px;
  cursor: pointer;
}

button[type="submit"]:hover {
  background-color: #a050e0;
}

/* ✅ Scrollbars */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background-color: #5e2b94;
  border-radius: 10px;
  border: 2px solid #1a1a1a;
}

/* ✅ Top Controls Row */
.top-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  width: 100%;
  max-width: 1000px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}

/* ✅ Character Dropdown (Left) */
.character-select {
  flex: 1;
  max-width: 300px;
}

/* ✅ Model Dropdown (Right) */
.model-select {
  flex: 1;
  max-width: 300px;
  text-align: right;
}

/* ✅ Avatar Beside Chat */
.main-layout {
  display: flex;
  gap: 2rem;
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.avatar-box img {
  width: 180px;
  height: 300px;
  border-radius: 12px;
  border: 3px solid #fff;
  object-fit: cover;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

#character-name {
  margin-top: 0.5rem;
  font-weight: bold;
  font-size: 1rem;
  color: #b88de6;
}

/* ✅ Chat Area Next to Avatar */
.chat-area {
  flex: 1;
}

.message-box .heart-icon {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 1.2rem;
  line-height: 1;
  width: 1.2rem;
  height: 1.2rem;
  display: inline-block;
  text-align: center;
  color: #aaa;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.message-box .heart-icon.liked {
  color: red;
}

/* 🛠️ Tool Tray Row Placement */
.tool-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.3rem;
  margin-left: 1.2rem;
  max-width: 60%;
}

.tray-toggle {
  cursor: pointer;
  user-select: none;
  font-size: 1.3rem;
  color: #aaa;
}

.tool-tray {
  display: none;
  background: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  gap: 0.5rem;
  align-items: center;
  cursor: default;
  user-select: none;
}

.tool-tray.open {
  display: flex !important;
}

.tool-tray .icon {
  cursor: pointer;
  font-size: 1.1rem;
  transition: transform 0.2s;
}

.tool-tray .icon:hover {
  transform: scale(1.2);
}

.tray-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.2rem 0 1rem 1.2rem;
  max-width: 60%;
}

.bubble-wrapper {
  width: 100%;
}

.tool-tray .icon {
  cursor: pointer;
}

.tray-toggle {
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
  letter-spacing: 0.1rem;
  color: #b18aff;
  opacity: 0.8;
  transition: transform 0.2s, opacity 0.2s;
}

.tray-toggle:hover {
  transform: scale(1.1);
  opacity: 1;
}

/* 🟣 Modal styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #1a1a1a;
  color: #f3eaff;
  border-radius: 16px;
  padding: 20px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.2);
  display: flex;
  flex-direction: column;
}

#edit-text {
  background: #2b1e3f;
  color: #f3eaff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  resize: vertical;
  min-height: 120px;
}

.modal-buttons {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-buttons button {
  background: #6b3fa0;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
}

.modal-buttons button:hover {
  background: #8453c7;
}

/* 🔮 Bottom Banner & Footer */
.footer-banner {
  width: 100%;
  margin-top: auto; /* Keeps footer pinned to the bottom */
  background: linear-gradient(135deg, #2b084e 0%, #4b127a 50%, #2b084e 100%);
  border-top: 2px solid rgba(252, 176, 69, 0.4);
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.5);
  padding: 1.5rem 1rem;
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-tagline {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 1rem;
  color: #d1b3ff;
  margin-bottom: 0.35rem;
  letter-spacing: 0.3px;
}

.footer-credit {
  font-size: 0.85rem;
  color: #fff8f0;
  opacity: 0.85;
}

.footer-credit a {
  color: #fcb045;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.footer-credit a:hover {
  color: #ffd27d;
  text-shadow: 0 0 8px rgba(252, 176, 69, 0.6);
  text-decoration: underline;
}

/* ==========================================================================
   🔐 Login Modal Overlay
   ========================================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 20, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

/* Hide modal when logged in */
.auth-overlay.hidden {
  display: none !important;
}

.auth-card {
  background: #231b2e;
  border: 1px solid #4a3363;
  color: #f7f5fa;
  padding: 2.2rem;
  border-radius: 14px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.auth-card h2 {
  font-family: 'Baloo 2', cursive, sans-serif;
  color: #ffcc70;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.auth-card p {
  color: #cbbad9;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.auth-card input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid #4a3363;
  background: #15101c;
  color: #fff;
  font-size: 1rem;
  box-sizing: border-box;
}

.auth-card input:focus {
  outline: none;
  border-color: #ffcc70;
}

.auth-card button {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  border-radius: 8px;
  border: none;
  background: #ffcc70;
  color: #1f122b;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.auth-card button:hover {
  opacity: 0.9;
}

.auth-error-msg {
  color: #ff6b6b;
  font-size: 0.85rem;
  margin-top: 12px;
}

/* 📱 Mobile adjustments for on-the-go chatting */
@media (max-width: 768px) {
  .top-controls {
    flex-direction: column;
    gap: 1rem;
    padding: 0 1rem;
  }

  .character-select, .model-select {
    max-width: 100%;
    text-align: left;
  }

  .main-layout {
    flex-direction: column;
    align-items: center;
    padding: 0 1rem;
  }

  .avatar-box img {
    width: 110px;
    height: 160px;
  }

  .chat-panel {
    width: 100%;
  }

  .message-box {
    max-width: 85%;
  }
}

.banner {
  position: relative;
}

.banner-logout-btn {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.banner-logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
