/* ==============================================
   JANITOR AI LOCAL - MAIN CSS
   Modern Dark Theme Design System (JanitorAI Style)
   ============================================== */

/* Jura font for JanitorAI-style headings */
@import url('https://fonts.googleapis.com/css2?family=Jura:wght@300..700&display=swap');

/* ========== CSS VARIABLES ========== */
:root {
  /* Default: Dark Mode */
  --primary: #9d8df1;
  --primary-hover: #b7a9f5;
  --primary-pink: #F786F4;
  --primary-purple: #AE99FF;
  --secondary: #1f1f2e;
  --bg-dark: #121218;
  --bg-card: #1f1f2e;
  --text-main: #ffffff;
  --text-muted: #a1a1aa;
  --text-description: #D7CFEF;

  /* Status Colors */
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;

  /* Borders & Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;
  --border-color: rgba(255, 255, 255, 0.08);

  /* Shadows */
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);

  /* Card Gradient (JanitorAI style) */
  --card-gradient: linear-gradient(140deg, #F786F4 0%, rgb(29, 12, 49) 40%, rgb(96, 83, 143) 90%, rgb(168, 151, 244) 100%);
  --card-inner-gradient: linear-gradient(141deg, rgb(255 89 211 / 12%) 12%, rgb(68 0 255 / 22%) 37%, rgb(37 13 80 / 46%) 80%, rgb(143 91 181 / 22%) 100%);

  /* Fonts */
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Jura', sans-serif;
  --font-heading: 'Jura', sans-serif;
}

/* Gray Theme (JanitorAI Default) */
[data-theme="gray"] {
  --bg-dark: #313338;
  --bg-card: rgba(12, 11, 11, 0.84);
  --secondary: #2b2d31;
  --border-color: rgba(255, 255, 255, 0.1);
  --primary: #F786F4;
  --primary-hover: #AE99FF;
}

/* Dark Theme (Original) */
[data-theme="dark"] {
  --bg-dark: #121218;
  --bg-card: #1f1f2e;
  --secondary: #1f1f2e;
  --primary: #9d8df1;
  --primary-hover: #b7a9f5;
}

/* ========== RESET & BASE ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ========== TYPOGRAPHY ========== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: white;
}

/* ========== LAYOUT ========== */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.grid {
  display: grid;
  gap: var(--spacing-md);
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.justify-center {
  justify-content: center;
}

.gap-sm {
  gap: var(--spacing-sm);
}

.gap-md {
  gap: var(--spacing-md);
}

.w-full {
  width: 100%;
}

.mt-md {
  margin-top: var(--spacing-md);
}

.mb-md {
  margin-bottom: var(--spacing-md);
}

.mb-lg {
  margin-bottom: var(--spacing-lg);
}

.p-md {
  padding: var(--spacing-md);
}

.hidden {
  display: none !important;
}

/* Character Grid Responsive */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
  padding: var(--spacing-lg) 0;
}

/* Create Page */
.create-page {
  width: 100%;
}

.create-page * {
  min-width: 0;
}

/* ========== COMPONENTS ========== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  gap: 0.5rem;
  background: transparent;
  color: var(--text-main);
  font-size: 0.9rem;
}

.btn-primary {
  background-color: var(--primary);
  color: #1a1a2e;
  /* Dark text on primary */
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--secondary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.2);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
}

.btn-outline {
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Cards */
.card {
  background-color: var(--secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.character-card {
  height: 420px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
  background: var(--bg-card);
  overflow: hidden;
}

.character-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.card-image-wrapper {
  position: relative;
  height: 65%;
  overflow: hidden;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  background: var(--bg-dark);
  transition: transform 0.2s ease;
}

.character-card:hover .card-image {
  transform: none;
}

.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: var(--spacing-sm);
  display: flex;
  justify-content: flex-end;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.character-card:hover .card-overlay {
  opacity: 1;
}

.card-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.action-btn {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.action-btn:hover {
  background: var(--danger);
}

.card-content {
  padding: var(--spacing-md);
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
}

.character-name {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
  font-weight: 700;
}

.character-stats {
  display: flex;
  gap: var(--spacing-md);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-md);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.character-description {
  font-size: 0.85rem;
  color: #d1d5db;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: auto;
  line-height: 1.4;
}

.character-tags {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-top: var(--spacing-sm);
  scrollbar-width: none;
  margin-top: var(--spacing-sm);
}

.tag {
  font-size: 0.7rem;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  color: var(--text-muted);
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Navbar */
.navbar {
  background: rgba(18, 18, 24, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 0;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-logo img {
  height: 32px;
}

.nav-links {
  display: flex;
  gap: var(--spacing-lg);
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s;
  font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
  color: white;
}

/* Search Bar */
.search-container {
  position: relative;
  max-width: 600px;
  margin: var(--spacing-xl) auto;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1rem 1rem 1rem 3rem;
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #1f1f2e;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  padding: var(--spacing-lg);
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.close-modal:hover {
  color: white;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.95rem;
}

.form-range {
  width: 100%;
  height: 4px;
  background: #333;
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #4ade80;
  /* Green from screenshot */
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
  border: 2px solid #1f1f2e;
  margin-top: -6px;
  /* center thumb */
}

.form-range::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: #333;
  border-radius: 2px;
}

.range-value {
  float: right;
  background: #333;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  min-width: 50px;
  text-align: center;
}

.form-select {
  width: 100%;
  padding: 0.75rem;
  background: #2a2a30;
  border: 1px solid #333;
  border-radius: var(--radius-sm);
  color: white;
  outline: none;
  cursor: pointer;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* Chat Styles (New) */

.chat-layout {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  background: var(--bg-dark);
}

.chat-header {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(18, 18, 24, 0.95);
}

.chat-messages {
  overflow-y: auto;
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.message {
  display: flex;
  gap: var(--spacing-md);
  max-width: 800px;
  position: relative;
  /* For absolute positioning of delete button if needed, but we use flex */
  align-items: flex-end;
  /* Align avatar to bottom */
}

.message.same-sender {
  margin-top: -1rem;
  /* Pull up closer to previous message */
}

/* Hide avatar on same-sender but keep space? 
   Actually, let's keep it simple: Hidden visibility preserves space.
   BUT, if multiple messages, we usually want avatar on the LAST one?
   The HTML logic I wrote does checks previous. So if I have Msg1, Msg2.
   Msg1: isSameSender=false. Show Avatar.
   Msg2: isSameSender=true. Hide Avatar.
   So Avatar is on TOP. Align items flex-start then.
*/
.message {
  align-items: flex-start;
  /* Align avatar to top of message */
}

.message.same-sender .message-avatar {
  height: 0;
  /* Collapse height to pull up? No, that messes alignment. */
  visibility: hidden;
  /* If we want to reduce gap more, we might need to change structure, but margin-top negative works ok usually. */
}

/* Delete Button */
.delete-msg-btn {
  opacity: 0;
  transition: opacity 0.2s;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.5rem;
  color: var(--text-muted);
}

.message:hover .delete-msg-btn {
  opacity: 1;
}

.delete-msg-btn:hover {
  color: var(--danger);
  transform: scale(1.1);
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.message-content {
  background: var(--secondary);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border-top-left-radius: 0;
  line-height: 1.6;
}

.message.user .message-content {
  background: var(--secondary);
  /* Both dark bubbles in example usually */
  border: 1px solid var(--primary);
  /* Border for user? or maybe fill */
  background: rgba(157, 141, 241, 0.1);
  border-color: rgba(157, 141, 241, 0.3);
  color: white;
  border-radius: var(--radius-md);
  border-top-right-radius: 0;
}

.chat-input-area {
  padding: var(--spacing-md);
  background: var(--bg-dark);
  border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
  background: var(--secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm);
  display: flex;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: white;
  padding: var(--spacing-sm);
  resize: none;
  min-height: 44px;
  max-height: 200px;
  font-family: inherit;
}

.chat-textarea:focus {
  outline: none;
}

.send-btn {
  background: var(--primary);
  color: #1a1a2e;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: var(--spacing-sm);
}

.typing-indicator {
  padding: 1rem;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
}

/* Sidebar & App Layout */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-dark);
}

.sidebar {
  width: 300px;
  background: rgba(30, 30, 40, 0.5);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: var(--spacing-md);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-avatar {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  object-fit: cover;
  margin-bottom: var(--spacing-md);
  border: 3px solid var(--primary);
  box-shadow: 0 0 20px rgba(157, 141, 241, 0.2);
}

.sidebar-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.5rem;
}

.sidebar-status {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all 0.2s;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  width: 100%;
  text-align: left;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.nav-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Prompt Presets UI in Settings */
.preset-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: var(--spacing-md);
  padding-right: var(--spacing-xs);
}

.preset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s;
}

.preset-item:hover {
  border-color: var(--primary);
}

.preset-item.active {
  border-color: var(--primary);
  background: rgba(157, 141, 241, 0.05);
}

.preset-actions {
  display: flex;
  gap: var(--spacing-xs);
}

/* Mobile Responsive */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    background: var(--bg-dark);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .mobile-menu-btn {
    display: block;
  }
}

@media (min-width: 901px) {
  .mobile-menu-btn {
    display: none;
  }
}

/* ========== CHAT MESSAGE FORMATTING (JanitorAI Style) ========== */

/* Italic text = Gray narration / actions */
.chat-italic {
  color: #9ca3af !important;
  font-style: italic;
}

/* Bold text = White */
.chat-bold {
  color: #ffffff !important;
  font-weight: 600;
}

/* Dialogue (quoted speech) = White */
.chat-dialogue {
  color: #ffffff !important;
}

/* Message content container - base styling */
.message-content {
  line-height: 1.75;
  font-size: 18px;
}

/* Bot messages: default text is gray (narration) */
.message-content.bot-message {
  color: #9ca3af;
}

/* User messages: default text is white */
.message-content.user-message {
  color: #ffffff;
}

/* Streaming text - no animation to prevent opacity flickering during chunk updates */
.streaming-text {
  opacity: 1;
}

/* Typing cursor animation */
.typing-cursor {
  display: inline;
  color: #805ad5;
  animation: blink 0.7s infinite;
  margin-left: 2px;
}

@keyframes blink {

  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0;
  }
}

/* ========== JANITORAI STYLE CARDS ========== */

/* Gradient Card Wrapper */
.card-janitor {
  position: relative;
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  min-width: 160px;
}

.card-janitor::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: var(--card-gradient);
  border-radius: 8px;
  z-index: -1;
  pointer-events: none;
}

.card-janitor:hover {
  box-shadow: 0 0 20px rgba(247, 134, 244, 0.3);
}

/* Card Name - Pink JanitorAI style */
.card-janitor .character-name {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary-pink);
  font-size: 13px;
}

/* Card Description */
.card-janitor .character-description {
  color: var(--text-description);
  font-size: 0.7rem;
  line-height: 1.5;
}

/* Chat Count Ribbon */
.chat-ribbon {
  position: absolute;
  right: 0;
  top: 40px;
  z-index: 1;
}

.chat-ribbon-content {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-heading);
  color: white;
}

/* Star Line Decoration */
.star-line {
  border-top: 1px solid #AF95E6;
  width: 80%;
  position: relative;
  margin: 12px auto;
}

.star-line img {
  position: absolute;
  right: -45px;
  top: -38px;
  pointer-events: none;
}

/* ========== JANITORAI TAGS ========== */

.tag-system {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 20px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-description);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s;
}

.tag-system:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary-purple);
}

/* Special Limitless Tag */
.tag-limitless {
  background: linear-gradient(135deg, rgba(139, 69, 255, 0.15) 0%, rgba(75, 0, 130, 0.2) 100%);
  border: 1px solid rgba(139, 69, 255, 0.3);
  color: #E6D7FF;
}

/* Custom Hashtags */
.tag-custom {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 20px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #98D8C8;
  background: transparent;
  border: 1px solid rgba(152, 216, 200, 0.3);
  transition: all 0.2s;
}

.tag-custom:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: #98D8C8;
}

/* Tags Container */
.character-tags-janitor {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 8px 12px;
}

/* Token Count Footer */
.token-count {
  font-size: 0.6rem;
  font-family: 'Share Tech Mono', monospace;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding-bottom: 4px;
  opacity: 0.8;
}

/* ========== FOOTER ========== */

.site-footer {
  background: var(--bg-dark);
  border-top: 1px solid var(--border-color);
  padding: 24px;
  margin-top: 48px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-brand {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.footer-brand strong {
  color: var(--primary-pink);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 14px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary-pink);
}

.footer-separator {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Discord Link */
.discord-link {
  color: #5865F2 !important;
}

.discord-link:hover {
  color: #7289DA !important;
}

/* ========== HERO SECTION ========== */

.hero-section {
  text-align: center;
  padding: 32px 0;
}

.hero-text {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 8px;
}

.hero-subtext {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ========== NAV LOGO GLOW ========== */

.nav-logo-glow {
  color: var(--primary-pink);
  text-shadow: 0 0 10px rgba(247, 134, 244, 0.5);
}

.logo-badge {
  font-size: 0.75rem;
  font-weight: 900;
  font-family: var(--font-heading);
  margin-left: 4px;
  color: var(--primary-pink);
}

/* ========== THEME TOGGLE ========== */

.theme-toggle-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.theme-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--secondary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.theme-btn:hover {
  border-color: var(--primary);
}

.theme-btn.active {
  background: var(--primary);
  color: #1a1a2e;
  border-color: var(--primary);
}

/* Creator Name with Badge */
.creator-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-purple);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}

.creator-name:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .create-page {
    padding: 1rem 0.75rem 6rem !important;
  }

  .create-page #pageTitle {
    font-size: 1.5rem !important;
  }

  .create-tab-list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px !important;
    padding: 6px !important;
  }

  .create-tab-list .create-tab {
    flex: none !important;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px !important;
    font-size: 13px !important;
    white-space: normal !important;
    text-align: center;
  }

  .create-panel {
    padding: 20px 16px !important;
  }

  .create-two-col-grid {
    grid-template-columns: 1fr !important;
  }

  .create-preview-row,
  .create-action-row,
  .create-card-preview-row,
  .create-card-actions,
  .create-avatar-row,
  .create-avatar-input-row,
  .create-manual-actions,
  .ai-create-header,
  .ai-create-load-row,
  .ai-create-input-row,
  .ai-create-ready-row,
  .ai-create-ready-actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .create-action-row > button,
  .create-card-actions > button,
  .create-manual-actions > button,
  .ai-create-load-row > button,
  .ai-create-ready-actions > button,
  .ai-create-input-row > button {
    width: 100%;
  }

  .create-avatar-controls,
  .create-avatar-input-row > input,
  .create-avatar-input-row > button,
  .create-avatar-input-row > label {
    width: 100%;
  }

  .create-avatar-input-row > label {
    display: block !important;
    text-align: center;
  }

  .ai-create-panel {
    height: calc(100dvh - 180px) !important;
    min-height: 520px;
  }

  .ai-create-header,
  #aiCreateSettingsBar,
  #aiCreateLoadBar,
  #aiCreateChatArea,
  #aiCreateReadyBanner {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .ai-create-settings-row {
    align-items: stretch !important;
  }

  .ai-create-setting {
    width: 100%;
  }

  .ai-create-settings-info {
    width: 100%;
    justify-content: flex-start;
  }

  #aiCreateProvider,
  #aiCreateModel,
  #aiCreateCharSelect,
  #aiCreateInput {
    width: 100%;
  }

  #aiCreateResetBtn {
    width: 100%;
  }
}
