/* ========================================
   MODERN GLASSMORPHISM UI - 2025 Design
   Sleek, Sharp, Premium Chat Experience
   ======================================== */

:root {
  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Spacing & Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;
}

/* Light Theme (default) — uses :root for lower specificity than html[data-theme] */
:root {
  --bg: linear-gradient(135deg, #ffffff 0%, #f4f4f4 100%);
  --bg-raw: #f4f4f4;
  --surface: rgba(255, 255, 255, 0.6);
  --surface-hover: rgba(255, 255, 255, 0.8);
  --surface-elevated: rgba(255, 255, 255, 0.95);
  --text: #050505;
  --text-secondary: #555555;
  --text-muted: #888888;
  --primary: #111111;
  --primary-light: #333333;
  --primary-dark: #000000;
  --accent-gradient: linear-gradient(135deg, #444444 0%, #000000 100%);
  --glow: rgba(0, 0, 0, 0.15);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 1px rgba(255, 255, 255, 1);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12), inset 0 1px 1px rgba(255, 255, 255, 1);
  --shadow-glow: 0 0 40px var(--glow), inset 0 1px 1px rgba(255, 255, 255, 0.5);
  --glass-bg: rgba(255, 255, 255, 0.5);
  --glass-border: 1px solid rgba(0, 0, 0, 0.06);
  --glass-blur: blur(24px) saturate(150%);
  --glass-blur-heavy: blur(48px) saturate(180%);
}

/* Dark Theme - Activated by JS toggle */
html[data-theme="dark"] {
  --bg: linear-gradient(135deg, #050505 0%, #111111 100%);
  --bg-raw: #050505;
  --surface: rgba(30, 30, 30, 0.4);
  --surface-hover: rgba(50, 50, 50, 0.5);
  --surface-elevated: rgba(40, 40, 40, 0.6);
  --text: #ffffff;
  --text-secondary: #aaaaaa;
  --text-muted: #777777;
  --primary: #ffffff;
  --primary-light: #e0e0e0;
  --primary-dark: #ffffff;
  --accent-gradient: linear-gradient(135deg, #ffffff 0%, #888888 100%);
  --glow: rgba(255, 255, 255, 0.15);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.25);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.8), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  --shadow-glow: 0 0 40px var(--glow), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  --glass-bg: rgba(10, 10, 10, 0.5);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --glass-blur: blur(24px) saturate(150%);
  --glass-blur-heavy: blur(48px) saturate(180%);
}


/* ========================================
   BASE & RESET
   ======================================== */

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.4s ease, color 0.4s ease;
}

body { 
  overflow: hidden;
  position: relative;
}

/* Animated Background Mesh - Subtle Hue Shift */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(200, 200, 255, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(255, 200, 200, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(200, 255, 200, 0.02) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: meshMove 25s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

@keyframes meshMove {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); filter: hue-rotate(0deg); }
  50% { transform: translate(2vw, -2vh) scale(1.05) rotate(2deg); filter: hue-rotate(45deg); }
  100% { transform: translate(-2vw, 2vh) scale(1.1) rotate(-2deg); filter: hue-rotate(90deg); }
}

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

.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  box-shadow: var(--shadow-sm);
}

.glass-strong {
  background: var(--surface-elevated);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: var(--glass-border);
  box-shadow: var(--shadow-md);
}

.glass-card {
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.6);
}

/* ========================================
   LAYOUT
   ======================================== */

.app-layout {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ========================================
   SIDEBAR - Glass Panel
   ======================================== */

.sidebar {
  width: 280px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: var(--glass-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: var(--glass-border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.logo-mark::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 50%);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* Sidebar Sections */
.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 16px 24px 8px;
  margin: 0;
}

/* Stats Button */
.sidebar-stats-section {
  padding: 8px 20px;
  margin-bottom: 4px;
}

.stats-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
}

.stats-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
}

.stats-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.stats-btn:active {
  transform: translateY(0);
}

/* Prompt Templates */
.prompt-templates {
  padding: 4px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.template-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.template-btn:hover {
  background: var(--surface-hover);
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, 0.6);
}

.template-btn:hover::before {
  opacity: 1;
}

.template-btn span {
  font-size: 1.1rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Model Select */
.sidebar-model-select {
  padding: 8px 20px;
  flex: 1;
  overflow-y: auto;
}

.model-select-wrapper {
  position: relative;
}

.model-select-wrapper select {
  width: 100%;
  padding: 12px 36px 12px 14px;
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  transition: all 0.2s ease;
}

.model-select-wrapper select:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.6);
}

.model-select-wrapper select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--glow);
}

.select-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-secondary);
}

/* optgroup styling */
select optgroup {
  font-weight: 600;
  color: var(--primary);
  background: var(--bg-raw);
}

select option {
  padding: 8px;
  font-weight: 400;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* Top Bar */
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: var(--glass-border);
  position: relative;
  z-index: 20;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.topbar-label {
  font-size: 1rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.01em;
}

.mode-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  background: var(--surface);
  border-radius: var(--radius-full);
  color: var(--primary);
  border: var(--glass-border);
}

/* Icon Buttons */
.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.icon-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.icon-btn svg {
  position: relative;
  z-index: 1;
  transition: all 0.25s ease;
}

.icon-btn:hover {
  border-color: var(--primary-light);
  color: white;
  transform: scale(1.05);
}

.icon-btn:hover::before {
  opacity: 1;
}

.icon-btn:active {
  transform: scale(0.95);
}

/* Export Wrapper */
.export-wrapper {
  position: relative;
}

.export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 100;
}

.export-menu.show {
  display: block;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.export-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.export-option:hover {
  background: var(--surface-hover);
}

/* ========================================
   CHAT AREA
   ======================================== */

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  scroll-behavior: smooth;
  min-height: 0;
}

.chat-scroll.aurora-bg {
  position: relative;
}

/* Utility classes used in HTML */
.glass-premium {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  box-shadow: var(--shadow-sm);
}

.grad-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card-lift {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.float-animation {
  animation: float 6s ease-in-out infinite;
}

.chat-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Welcome Screen */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 24px;
  padding: 40px 20px;
}

.welcome-logo {
  width: 80px;
  height: 80px;
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.welcome-logo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 50%);
}

.welcome-title {
  font-size: 2rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}

.welcome-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.7;
}

/* Suggestion Chips */
.chips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 500px;
  width: 100%;
  margin-top: 16px;
}

.chip {
  padding: 16px;
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chip:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.6);
}

.chip:hover::before {
  opacity: 0.05;
}

.chip-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.chip-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  position: relative;
  z-index: 1;
}

/* Messages */
.message-row {
  display: flex;
  gap: 12px;
  animation: messageIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  background: var(--surface);
  border: var(--glass-border);
}

.message-row.ai .message-avatar {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-glow);
}

.message {
  max-width: calc(100% - 60px);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  position: relative;
}

.message-row.user .message {
  background: var(--accent-gradient);
  color: white;
  border-bottom-right-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.message-row.ai .message {
  background: var(--surface);
  border: var(--glass-border);
  border-bottom-left-radius: var(--radius-sm);
}

.message-content {
  font-size: 0.95rem;
  line-height: 1.6;
  word-wrap: break-word;
}

.message-content p {
  margin-bottom: 0.8em;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* Message Actions */
.message-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-action-btn {
  padding: 4px 8px;
  background: transparent;
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.message-action-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Feedback Buttons */
.message-feedback {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.message:hover .message-feedback {
  opacity: 1;
}

.feedback-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.feedback-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: scale(1.05);
}

.feedback-btn.positive:hover {
  border-color: #22c55e;
  color: #22c55e;
}

.feedback-btn.negative:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.feedback-btn.submitted {
  opacity: 0.5;
  pointer-events: none;
}

/* ========================================
   INPUT AREA
   ======================================== */

.input-area {
  padding: 16px 24px 24px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: var(--glass-border);
}

.input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.input-container {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.input-container:focus-within {
  border-color: var(--text-secondary);
  box-shadow: 0 0 24px var(--glow), var(--shadow-md);
  transform: translateY(-2px);
}

#userInput {
  flex: 1;
  min-height: 24px;
  max-height: 200px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  outline: none;
}

#userInput::placeholder {
  color: var(--text-muted);
}

.input-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s ease;
}

.input-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

#sendBtn {
  background: var(--accent-gradient);
  border: none;
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

#sendBtn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

#sendBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========================================
   MODALS
   ======================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal.hidden {
  display: none;
  opacity: 0;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: var(--glass-border);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Provider Stats */
.provider-stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.provider-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.provider-stat-item:hover {
  background: var(--surface-hover);
}

.provider-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.provider-cost {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
}

/* ========================================
   SCROLLBAR
   ======================================== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: var(--radius-full);
  border: var(--glass-border);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--surface-hover);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }
  
  .sidebar {
    position: fixed;
    left: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    z-index: 9999;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .topbar {
    padding: 0 16px;
    height: 56px;
  }
  
  .chat-scroll {
    padding: 16px 12px;
  }
  
  .welcome-title {
    font-size: 1.5rem;
  }
  
  .welcome-logo {
    width: 64px;
    height: 64px;
  }
  
  .chips-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .input-area {
    padding: 12px 16px 16px;
  }
  
  .message {
    max-width: calc(100% - 44px);
    padding: 12px 16px;
  }
  
  .modal-content {
    max-height: 90vh;
    border-radius: var(--radius-md);
  }
}

@media (max-width: 480px) {
  .message-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
  
  .input-container {
    padding: 8px 12px;
    border-radius: var(--radius-md);
  }
  
  .icon-btn, .input-btn {
    width: 32px;
    height: 32px;
  }
}
/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden { display: none !important; }
.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-gradient { background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.glow { box-shadow: var(--shadow-glow); }

/* Keyboard shortcuts */
kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 0 var(--border);
}
