/* ═══════════════════════════════════════════════════════════════════════════
   RabAI v5.0 "IndieDev Edition" — Stylesheet
   RabbitGamesStudio™ / RGS Labs™
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────
   1. CSS Custom Properties (Variables)
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Accent Colors */
  --accent: #7c6af7;
  --accent-rgb: 124, 106, 247;
  --accent-light: #9b8ef9;
  --accent-dark: #5e4fd4;
  --accent-glow: rgba(124, 106, 247, 0.3);

  /* Theme: Dark (default) */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --bg-card: #161622;
  --bg-hover: #1e1e32;
  --bg-active: #252540;
  --bg-overlay: rgba(10, 10, 15, 0.85);
  --bg-modal: #1a1a2e;

  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b85;
  --text-inverse: #0a0a0f;

  --border-color: #2a2a40;
  --border-light: #1f1f35;
  --border-focus: var(--accent);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --shadow-accent: 0 0 30px rgba(var(--accent-rgb), 0.15);

  /* Status Colors */
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed: 60px;
  --header-height: 60px;
  --input-height: 56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Z-index */
  --z-sidebar: 100;
  --z-header: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-loading: 500;
  --z-cursor: 1000;
}

/* Theme: Light */
[data-theme="light"] {
  --bg-primary: #f5f5fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #ececf5;
  --bg-card: #ffffff;
  --bg-hover: #e8e8f2;
  --bg-active: #dddde8;
  --bg-overlay: rgba(245, 245, 250, 0.9);
  --bg-modal: #ffffff;

  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8a8aa0;
  --text-inverse: #ffffff;

  --border-color: #d0d0e0;
  --border-light: #e0e0ec;
  --border-focus: var(--accent);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Accent Variants */
[data-accent="blue"] {
  --accent: #3b82f6;
  --accent-rgb: 59, 130, 246;
  --accent-light: #60a5fa;
  --accent-dark: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.3);
}

[data-accent="green"] {
  --accent: #22c55e;
  --accent-rgb: 34, 197, 94;
  --accent-light: #4ade80;
  --accent-dark: #16a34a;
  --accent-glow: rgba(34, 197, 94, 0.3);
}

[data-accent="red"] {
  --accent: #ef4444;
  --accent-rgb: 239, 68, 68;
  --accent-light: #f87171;
  --accent-dark: #dc2626;
  --accent-glow: rgba(239, 68, 68, 0.3);
}

[data-accent="amber"] {
  --accent: #f59e0b;
  --accent-rgb: 245, 158, 11;
  --accent-light: #fbbf24;
  --accent-dark: #d97706;
  --accent-glow: rgba(245, 158, 11, 0.3);
}

/* ─────────────────────────────────────────────────────────────────────────
   2. Reset & Base
   ───────────────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-light);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::selection {
  background: var(--accent);
  color: var(--text-inverse);
}

/* ─────────────────────────────────────────────────────────────────────────
   3. Loading Screen
   ───────────────────────────────────────────────────────────────────────── */

#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-loading);
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-logo {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-6);
  position: relative;
}

.loading-logo svg {
  width: 100%;
  height: 100%;
}

.loading-logo .rabbit-ear {
  transform-origin: bottom center;
  animation: earWiggle 2s ease-in-out infinite;
}

.loading-logo .rabbit-ear.right {
  animation-delay: 0.3s;
}

@keyframes earWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-4);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.loading-subtext {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.loading-version {
  position: absolute;
  bottom: var(--space-6);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─────────────────────────────────────────────────────────────────────────
   4. Custom Cursor
   ───────────────────────────────────────────────────────────────────────── */

.custom-cursor {
  position: fixed;
  width: 20px;
  height: 20px;
  pointer-events: none;
  z-index: var(--z-cursor);
  mix-blend-mode: difference;
  transition: transform var(--transition-fast);
}

.custom-cursor svg {
  width: 100%;
  height: 100%;
  fill: var(--accent);
  filter: drop-shadow(0 0 4px var(--accent-glow));
}

.custom-cursor.hover {
  transform: scale(1.5);
}

.custom-cursor.click {
  transform: scale(0.8);
}

/* ─────────────────────────────────────────────────────────────────────────
   5. Layout — App Shell
   ───────────────────────────────────────────────────────────────────────── */

#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────────────
   6. Sidebar
   ───────────────────────────────────────────────────────────────────────── */

#sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-base), transform var(--transition-base);
  z-index: var(--z-sidebar);
  flex-shrink: 0;
}

#sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

#sidebar.collapsed .sidebar-content {
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-brand svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-brand-text span {
  color: var(--accent);
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  transition: opacity var(--transition-fast);
}

.sidebar-section {
  margin-bottom: var(--space-6);
}

.sidebar-section-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-section-title button {
  font-size: var(--font-size-lg);
  color: var(--accent);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.sidebar-section-title button:hover {
  background: var(--accent-glow);
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.chat-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.chat-item:hover {
  background: var(--bg-hover);
}

.chat-item.active {
  background: var(--bg-active);
  border-left: 3px solid var(--accent);
}

.chat-item-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chat-item.active .chat-item-icon {
  color: var(--accent);
}

.chat-item-name {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item.active .chat-item-name {
  color: var(--text-primary);
  font-weight: 500;
}

.chat-item-actions {
  display: flex;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.chat-item:hover .chat-item-actions {
  opacity: 1;
}

.chat-item-actions button {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.chat-item-actions button:hover {
  background: var(--bg-tertiary);
  color: var(--error);
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: var(--text-inverse);
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-email {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-plan {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.user-plan .badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 1px var(--space-2);
  border-radius: 4px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
}

.user-plan .badge.pro {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--text-inverse);
}

.user-plan .badge.free {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.user-plan .badge.admin {
  background: linear-gradient(135deg, var(--warning), var(--error));
  color: var(--text-inverse);
}

.sidebar-actions {
  display: flex;
  gap: var(--space-2);
}

.sidebar-actions button {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
}

.sidebar-actions .btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
}

.sidebar-actions .btn-primary:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-glow);
}

.sidebar-actions .btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.sidebar-actions .btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-foot {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-3);
  font-family: var(--font-mono);
}

/* ─────────────────────────────────────────────────────────────────────────
   7. Main Content Area
   ───────────────────────────────────────────────────────────────────────── */

#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ─────────────────────────────────────────────────────────────────────────
   8. Header / Topbar
   ───────────────────────────────────────────────────────────────────────── */

#topbar {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  flex-shrink: 0;
  z-index: var(--z-header);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.topbar-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}

.topbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar-btn svg {
  width: 20px;
  height: 20px;
}

.topbar-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

/* ─────────────────────────────────────────────────────────────────────────
   9. Chat Area
   ───────────────────────────────────────────────────────────────────────── */

#chat-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  scroll-behavior: smooth;
}

/* Welcome Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8);
}

.welcome-logo {
  width: 96px;
  height: 96px;
  margin-bottom: var(--space-6);
}

.welcome-logo svg {
  width: 100%;
  height: 100%;
}

.welcome-title {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  margin-bottom: var(--space-3);
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  max-width: 500px;
}

.welcome-suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
  width: 100%;
  max-width: 700px;
}

.welcome-suggestion {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.welcome-suggestion:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.welcome-suggestion-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
  color: var(--accent);
}

.welcome-suggestion-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.welcome-suggestion-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Messages */
.message {
  display: flex;
  gap: var(--space-4);
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  animation: messageIn 0.3s ease;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.message-avatar.user {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.message-avatar.ai {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--text-inverse);
}

.message-avatar.ai svg {
  width: 20px;
  height: 20px;
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.message-author {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.message-time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.message-body {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  line-height: 1.7;
}

.message-body p {
  margin-bottom: var(--space-3);
}

.message-body p:last-child {
  margin-bottom: 0;
}

.message-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.message-body em {
  color: var(--accent-light);
}

.message-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-light);
}

.message-body pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  margin: var(--space-3) 0;
}

.message-body pre code {
  background: none;
  padding: 0;
  color: var(--text-secondary);
}

.message-body ul,
.message-body ol {
  margin: var(--space-3) 0;
  padding-left: var(--space-6);
}

.message-body li {
  margin-bottom: var(--space-1);
}

.message-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-4);
  margin: var(--space-3) 0;
  color: var(--text-muted);
  font-style: italic;
}

.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4 {
  color: var(--text-primary);
  margin: var(--space-4) 0 var(--space-2);
  font-weight: 700;
}

.message-body h1 { font-size: var(--font-size-2xl); }
.message-body h2 { font-size: var(--font-size-xl); }
.message-body h3 { font-size: var(--font-size-lg); }
.message-body h4 { font-size: var(--font-size-base); }

.message-body hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--space-4) 0;
}

.message-body table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-3) 0;
  font-size: var(--font-size-sm);
}

.message-body th,
.message-body td {
  border: 1px solid var(--border-color);
  padding: var(--space-2) var(--space-3);
  text-align: left;
}

.message-body th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

/* Message Actions */
.message-actions {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-2);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.message:hover .message-actions {
  opacity: 1;
}

.message-actions button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.message-actions button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.message-actions button.active {
  color: var(--accent);
}

.message-actions button.active.thumb-down {
  color: var(--error);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ─────────────────────────────────────────────────────────────────────────
   10. Input Area
   ───────────────────────────────────────────────────────────────────────── */

#input-area {
  padding: var(--space-4) var(--space-5);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.input-container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-4);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0;
  resize: none;
  min-height: 24px;
  max-height: 200px;
  font-size: var(--font-size-base);
  line-height: 1.5;
}

.input-wrapper textarea:focus {
  box-shadow: none;
}

.input-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.input-actions button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.input-actions button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.input-actions .btn-send {
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: var(--text-inverse);
}

.input-actions .btn-send:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-glow);
}

.input-actions .btn-send:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.input-hint {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.input-hint kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-tertiary);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
}

/* Command Autocomplete */
.cmd-autocomplete {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
}

.cmd-autocomplete-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.cmd-autocomplete-item:hover,
.cmd-autocomplete-item.selected {
  background: var(--bg-hover);
}

.cmd-autocomplete-item .cmd-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.cmd-autocomplete-item .cmd-info {
  flex: 1;
  min-width: 0;
}

.cmd-autocomplete-item .cmd-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.cmd-autocomplete-item .cmd-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-autocomplete-item .cmd-shortcut {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ─────────────────────────────────────────────────────────────────────────
   11. Projects Screen
   ───────────────────────────────────────────────────────────────────────── */

#projects-screen {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6) var(--space-8);
}

.projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.projects-header h1 {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--text-primary);
}

.projects-header h1 span {
  color: var(--accent);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-5);
  max-width: 1200px;
  margin: 0 auto;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
  transform: translateY(-4px);
}

.project-card:hover::before {
  opacity: 1;
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.project-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: var(--font-size-xl);
}

.project-card-actions {
  display: flex;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.project-card:hover .project-card-actions {
  opacity: 1;
}

.project-card-actions button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.project-card-actions button:hover {
  background: var(--bg-hover);
  color: var(--error);
}

.project-card-name {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.project-card-genre {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 2px var(--space-2);
  border-radius: 4px;
  margin-bottom: var(--space-3);
}

.project-card-desc {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-4);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.project-card-meta svg {
  width: 14px;
  height: 14px;
}

/* New Project Card */
.project-card.new {
  border-style: dashed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: var(--space-3);
}

.project-card.new .new-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--font-size-xl);
  transition: all var(--transition-fast);
}

.project-card.new:hover .new-icon {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.project-card.new .new-text {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────
   12. Login Screen
   ───────────────────────────────────────────────────────────────────────── */

#login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  overflow-y: auto;
  padding: var(--space-6);
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-logo svg {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-4);
}

.login-logo h1 {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--text-primary);
}

.login-logo h1 span {
  color: var(--accent);
}

.login-logo p {
  color: var(--text-secondary);
  margin-top: var(--space-2);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}

.login-tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-6);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: var(--space-1);
}

.login-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  text-align: center;
}

.login-tab.active {
  background: var(--accent);
  color: var(--text-inverse);
}

.login-tab:hover:not(.active) {
  color: var(--text-primary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.login-form .form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.login-form label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.login-form .form-error {
  font-size: var(--font-size-sm);
  color: var(--error);
  display: none;
}

.login-form .form-error.visible {
  display: block;
}

.login-submit {
  width: 100%;
  padding: var(--space-4);
  background: var(--accent);
  color: var(--text-inverse);
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  margin-top: var(--space-2);
}

.login-submit:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-glow);
}

.login-submit:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.login-footer {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.login-footer a {
  color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────────────────
   13. Modals
   ───────────────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-6);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal.large {
  max-width: 720px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-5) var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* Form in Modal */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-group label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group label .required {
  color: var(--error);
}

.form-group .hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.form-group .error {
  font-size: var(--font-size-xs);
  color: var(--error);
  display: none;
}

.form-group .error.visible {
  display: block;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b85' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.accent-picker {
  display: flex;
  gap: var(--space-3);
}

.accent-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
}

.accent-option:hover {
  transform: scale(1.1);
}

.accent-option.selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-modal), 0 0 0 4px var(--text-primary);
}

.accent-option.purple { background: #7c6af7; }
.accent-option.blue { background: #3b82f6; }
.accent-option.green { background: #22c55e; }
.accent-option.red { background: #ef4444; }
.accent-option.amber { background: #f59e0b; }

.toggle-switch {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  width: 44px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  position: relative;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(20px);
  background: var(--text-inverse);
}

.toggle-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────────────────────────────────────
   14. Buttons
   ───────────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--error);
  color: var(--text-inverse);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-xs);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─────────────────────────────────────────────────────────────────────────
   15. Toast Notifications
   ───────────────────────────────────────────────────────────────────────── */

#toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  animation: toastIn 0.3s ease;
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-icon.success { color: var(--success); }
.toast-icon.error { color: var(--error); }
.toast-icon.warning { color: var(--warning); }
.toast-icon.info { color: var(--info); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.toast-message {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.toast-close {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────────────────────
   16. Info Modal (Commands List)
   ───────────────────────────────────────────────────────────────────────── */

.info-section {
  margin-bottom: var(--space-6);
}

.info-section:last-child {
  margin-bottom: 0;
}

.info-section h3 {
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.cmd-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cmd-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.cmd-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.cmd-item-info {
  flex: 1;
}

.cmd-item-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.cmd-item-desc {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────
   17. Settings Sections
   ───────────────────────────────────────────────────────────────────────── */

.settings-section {
  margin-bottom: var(--space-6);
}

.settings-section-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-label-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.settings-label-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.settings-value {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ─────────────────────────────────────────────────────────────────────────
   18. Ban Screen
   ───────────────────────────────────────────────────────────────────────── */

#ban-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  text-align: center;
  padding: var(--space-8);
}

.ban-icon {
  width: 80px;
  height: 80px;
  color: var(--error);
  margin-bottom: var(--space-6);
}

.ban-title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--error);
  margin-bottom: var(--space-3);
}

.ban-message {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  max-width: 400px;
}

.ban-timer {
  font-family: var(--font-mono);
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────────────────────
   19. Empty States
   ───────────────────────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--font-size-sm);
  max-width: 300px;
}

/* ─────────────────────────────────────────────────────────────────────────
   20. Animations
   ───────────────────────────────────────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fadeIn { animation: fadeIn 0.3s ease; }
.animate-slideUp { animation: slideUp 0.4s ease; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* ─────────────────────────────────────────────────────────────────────────
   21. Responsive
   ───────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  :root {
    --sidebar-width: 100vw;
  }

  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar.collapsed {
    width: var(--sidebar-width);
    transform: translateX(-100%);
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  #chat-area {
    padding: var(--space-3);
  }

  .message {
    gap: var(--space-3);
  }

  .welcome-suggestions {
    grid-template-columns: 1fr;
  }

  .topbar-title {
    font-size: var(--font-size-sm);
  }
}

@media (max-width: 480px) {
  #input-area {
    padding: var(--space-3);
  }

  .login-card {
    padding: var(--space-5);
  }

  .modal {
    margin: var(--space-3);
    max-height: calc(100vh - var(--space-6));
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   22. Utility Classes
   ───────────────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
.invisible { visibility: hidden; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

.border { border: 1px solid var(--border-color); }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.pointer-events-none { pointer-events: none; }