/* ── Reset ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ══════════════════════════════════════════════════
   THEMES
══════════════════════════════════════════════════ */
:root, [data-theme="dark"] {
  --bg-base:       #080c14;
  --bg-surface:    #0d1320;
  --bg-raised:     #111827;
  --bg-card:       rgba(17,24,39,0.75);
  --border:        rgba(255,255,255,0.07);
  --border-accent: rgba(56,189,248,0.25);
  --accent:        #38bdf8;
  --accent-2:      #818cf8;
  --accent-3:      #a78bfa;
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #475569;
  --msg-ai-bg:     rgba(255,255,255,0.04);
  --msg-ai-border: rgba(255,255,255,0.07);
  --msg-user-bg:   rgba(56,189,248,0.13);
  --msg-user-border:rgba(56,189,248,0.2);
  --sidebar-bg:    rgba(8,12,20,0.88);
  --header-bg:     rgba(8,12,20,0.65);
  --input-bg:      rgba(255,255,255,0.04);
  --orb1:          #38bdf8;
  --orb2:          #a78bfa;
  --orb3:          #818cf8;
  --shadow-glow:   0 0 40px rgba(56,189,248,0.08);
}

[data-theme="light"] {
  --bg-base:       #f8fafc;
  --bg-surface:    #ffffff;
  --bg-raised:     #f1f5f9;
  --bg-card:       rgba(255,255,255,0.9);
  --border:        rgba(0,0,0,0.08);
  --border-accent: rgba(14,165,233,0.3);
  --accent:        #0ea5e9;
  --accent-2:      #6366f1;
  --accent-3:      #8b5cf6;
  --text-primary:  #0f172a;
  --text-secondary:#475569;
  --text-muted:    #94a3b8;
  --msg-ai-bg:     #f1f5f9;
  --msg-ai-border: rgba(0,0,0,0.06);
  --msg-user-bg:   rgba(14,165,233,0.1);
  --msg-user-border:rgba(14,165,233,0.25);
  --sidebar-bg:    rgba(255,255,255,0.95);
  --header-bg:     rgba(255,255,255,0.85);
  --input-bg:      #f8fafc;
  --orb1:          #bae6fd;
  --orb2:          #ddd6fe;
  --orb3:          #c7d2fe;
  --shadow-glow:   0 0 40px rgba(14,165,233,0.06);
}

[data-theme="ocean"] {
  --bg-base:       #040d1a;
  --bg-surface:    #071226;
  --bg-raised:     #0a1a35;
  --bg-card:       rgba(7,18,38,0.8);
  --border:        rgba(6,182,212,0.1);
  --border-accent: rgba(6,182,212,0.3);
  --accent:        #06b6d4;
  --accent-2:      #0284c7;
  --accent-3:      #38bdf8;
  --text-primary:  #e0f7fa;
  --text-secondary:#67e8f9;
  --text-muted:    #164e63;
  --msg-ai-bg:     rgba(6,182,212,0.06);
  --msg-ai-border: rgba(6,182,212,0.12);
  --msg-user-bg:   rgba(6,182,212,0.15);
  --msg-user-border:rgba(6,182,212,0.3);
  --sidebar-bg:    rgba(4,13,26,0.92);
  --header-bg:     rgba(4,13,26,0.7);
  --input-bg:      rgba(6,182,212,0.05);
  --orb1:          #06b6d4;
  --orb2:          #0284c7;
  --orb3:          #0ea5e9;
  --shadow-glow:   0 0 40px rgba(6,182,212,0.1);
}

[data-theme="forest"] {
  --bg-base:       #050f08;
  --bg-surface:    #0a1a0e;
  --bg-raised:     #0f2415;
  --bg-card:       rgba(10,26,14,0.82);
  --border:        rgba(34,197,94,0.1);
  --border-accent: rgba(34,197,94,0.28);
  --accent:        #22c55e;
  --accent-2:      #16a34a;
  --accent-3:      #4ade80;
  --text-primary:  #ecfdf5;
  --text-secondary:#86efac;
  --text-muted:    #166534;
  --msg-ai-bg:     rgba(34,197,94,0.06);
  --msg-ai-border: rgba(34,197,94,0.1);
  --msg-user-bg:   rgba(34,197,94,0.13);
  --msg-user-border:rgba(34,197,94,0.28);
  --sidebar-bg:    rgba(5,15,8,0.92);
  --header-bg:     rgba(5,15,8,0.7);
  --input-bg:      rgba(34,197,94,0.05);
  --orb1:          #22c55e;
  --orb2:          #15803d;
  --orb3:          #4ade80;
  --shadow-glow:   0 0 40px rgba(34,197,94,0.08);
}

[data-theme="sunset"] {
  --bg-base:       #140609;
  --bg-surface:    #220c10;
  --bg-raised:     #2d1018;
  --bg-card:       rgba(34,12,16,0.82);
  --border:        rgba(251,113,133,0.1);
  --border-accent: rgba(251,113,133,0.28);
  --accent:        #fb7185;
  --accent-2:      #f97316;
  --accent-3:      #fbbf24;
  --text-primary:  #fff1f2;
  --text-secondary:#fda4af;
  --text-muted:    #9f1239;
  --msg-ai-bg:     rgba(251,113,133,0.06);
  --msg-ai-border: rgba(251,113,133,0.1);
  --msg-user-bg:   rgba(251,113,133,0.13);
  --msg-user-border:rgba(251,113,133,0.28);
  --sidebar-bg:    rgba(20,6,9,0.92);
  --header-bg:     rgba(20,6,9,0.7);
  --input-bg:      rgba(251,113,133,0.05);
  --orb1:          #fb7185;
  --orb2:          #f97316;
  --orb3:          #fbbf24;
  --shadow-glow:   0 0 40px rgba(251,113,133,0.08);
}

/* ── Base ─────────────────────────────────────────── */
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
}
.hidden { display: none !important; }

/* ── Aurora background ────────────────────────────── */
.bg-aurora {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
}
.aurora-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.18;
  animation: drift 18s ease-in-out infinite;
  transition: background 0.6s ease;
}
.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--orb1), transparent);
  top: -200px; left: -200px; animation-delay: 0s;
}
.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--orb2), transparent);
  bottom: -150px; right: -150px; animation-delay: -6s;
}
.orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--orb3), transparent);
  top: 40%; left: 50%; transform: translate(-50%,-50%);
  animation-delay: -12s;
}
.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 48px 48px;
}
@keyframes drift {
  0%, 100% { transform: translate(0,0) scale(1); }
  33%       { transform: translate(40px,-30px) scale(1.05); }
  66%       { transform: translate(-20px,40px) scale(0.95); }
}

/* ══════════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: fadeIn 0.5s ease;
}
.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(32px);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 48px 44px;
  max-width: 440px; width: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5), var(--shadow-glow);
  animation: scaleIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  justify-content: center; margin-bottom: 32px;
}
.login-logo-icon { width: 44px; height: 44px; animation: float 4s ease-in-out infinite; }
.login-logo-icon svg { width: 100%; height: 100%; }
.login-logo-text {
  font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-title {
  font-family: 'Syne', sans-serif; font-size: 24px; font-weight: 700;
  text-align: center; margin-bottom: 10px; color: var(--text-primary);
}
.login-subtitle {
  text-align: center; color: var(--text-secondary); font-size: 14px;
  margin-bottom: 32px; line-height: 1.6;
}
.google-btn {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 14px 24px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 14px; color: var(--text-primary);
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500;
  cursor: pointer; transition: all 0.25s; margin-bottom: 24px;
}
.google-btn:hover {
  background: var(--bg-raised); border-color: var(--border-accent);
  transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.google-btn:active { transform: translateY(0); }
.login-divider {
  text-align: center; position: relative; margin-bottom: 24px;
}
.login-divider::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0;
  height: 1px; background: var(--border);
}
.login-divider span {
  position: relative; background: var(--bg-card);
  padding: 0 12px; font-size: 12px; color: var(--text-muted);
}
.login-features { display: flex; flex-direction: column; gap: 12px; }
.login-feature {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-secondary);
}
.feature-icon { font-size: 16px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════════ */
.app-shell {
  position: relative; z-index: 1;
  display: flex; height: 100vh; overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: 280px; min-width: 280px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1),
              min-width 0.35s, width 0.35s;
  overflow: hidden;
}
.sidebar.collapsed { transform: translateX(-100%); min-width: 0; width: 0; }

.sidebar-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 32px; height: 32px; flex-shrink: 0; }
.logo-icon svg { width: 100%; height: 100%; }
.logo-text {
  font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 6px; border-radius: 8px;
  transition: all 0.2s; display: flex;
}
.sidebar-toggle svg { width: 20px; height: 20px; }
.sidebar-toggle:hover { color: var(--text-primary); background: var(--border); }

/* User profile */
.user-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin: 10px 10px 0;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 12px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--border-accent);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sign-out-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; border-radius: 6px;
  transition: all 0.2s; display: flex; flex-shrink: 0;
}
.sign-out-btn svg { width: 15px; height: 15px; }
.sign-out-btn:hover { color: #fb7185; background: rgba(251,113,133,0.1); }

/* New chat */
.new-chat-btn {
  margin: 12px 12px 0;
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: linear-gradient(135deg, rgba(56,189,248,0.1), rgba(129,140,248,0.1));
  border: 1px solid var(--border-accent);
  border-radius: 12px; color: var(--accent);
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.25s; white-space: nowrap;
}
.new-chat-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.new-chat-btn:hover {
  background: linear-gradient(135deg, rgba(56,189,248,0.2), rgba(129,140,248,0.2));
  transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* History */
.chat-history-section { flex: 1; overflow-y: auto; padding: 0 8px; margin-top: 8px; }
.chat-history-section::-webkit-scrollbar { width: 3px; }
.chat-history-section::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.history-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 8px 8px 6px;
}
.chat-history-list { display: flex; flex-direction: column; gap: 2px; }
.empty-history {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 32px 16px; color: var(--text-muted); font-size: 13px;
}
.empty-history svg { width: 32px; height: 32px; opacity: 0.5; }
.history-item {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  border-radius: 8px; cursor: pointer; transition: all 0.2s;
  border: 1px solid transparent; animation: slideInLeft 0.3s ease;
}
.history-item:hover { background: rgba(255,255,255,0.04); border-color: var(--border); }
.history-item.active { background: rgba(56,189,248,0.06); border-color: var(--border-accent); }
.history-item-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--border); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.history-item-content { flex: 1; min-width: 0; }
.history-item-title { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-meta { font-size: 11px; color: var(--text-muted); }
.history-item-delete {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; border-radius: 4px;
  opacity: 0; transition: all 0.2s; flex-shrink: 0; display: flex;
}
.history-item-delete svg { width: 14px; height: 14px; }
.history-item:hover .history-item-delete { opacity: 1; }
.history-item-delete:hover { color: #fb7185; background: rgba(251,113,133,0.1); }

/* Sidebar footer */
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.clear-all-btn {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; background: none; border: 1px solid transparent;
  border-radius: 8px; color: var(--text-muted);
  font-family: 'DM Sans', sans-serif; font-size: 13px;
  cursor: pointer; transition: all 0.2s;
}
.clear-all-btn svg { width: 15px; height: 15px; }
.clear-all-btn:hover { color: #fb7185; border-color: rgba(251,113,133,0.3); background: rgba(251,113,133,0.05); }

/* ── Chat Main ────────────────────────────────────── */
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* Header */
.chat-header {
  height: 60px; min-height: 60px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  background: var(--header-bg); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.4s;
}
.open-sidebar-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 6px; border-radius: 8px;
  transition: all 0.2s; display: none;
}
.open-sidebar-btn.visible { display: flex; }
.open-sidebar-btn svg { width: 20px; height: 20px; }
.open-sidebar-btn:hover { color: var(--text-primary); background: var(--border); }
.header-title {
  flex: 1; font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 600;
  color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Theme switcher */
.theme-switcher {
  display: flex; gap: 2px;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px;
}
.theme-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; width: 30px; height: 30px;
  border-radius: 7px; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.5;
}
.theme-btn:hover { opacity: 0.8; background: var(--border); }
.theme-btn.active { background: var(--border-accent); opacity: 1; }

/* Sound toggle */
.sound-toggle {
  background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px; cursor: pointer;
  color: var(--text-secondary); transition: all 0.2s;
  display: flex; align-items: center;
}
.sound-toggle svg { width: 16px; height: 16px; display: block; }
.sound-toggle:hover { color: var(--accent); border-color: var(--border-accent); }
.sound-toggle.muted { color: var(--text-muted); }

/* Status */
.header-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-secondary); white-space: nowrap;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80; box-shadow: 0 0 6px #4ade80;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.8); }
}

/* Messages */
.messages-container {
  flex: 1; overflow-y: auto; padding: 24px 0; scroll-behavior: smooth;
}
.messages-container::-webkit-scrollbar { width: 5px; }
.messages-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Welcome */
.welcome-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: calc(100vh - 220px);
  padding: 40px 24px; text-align: center; animation: fadeInUp 0.8s ease;
}
.welcome-avatar {
  width: 72px; height: 72px; margin-bottom: 24px;
  animation: float 4s ease-in-out infinite;
}
.welcome-avatar svg { width: 100%; height: 100%; }
.welcome-title {
  font-family: 'Syne', sans-serif; font-size: 38px; font-weight: 800;
  margin-bottom: 12px; line-height: 1.1; color: var(--text-primary);
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.welcome-sub { font-size: 16px; color: var(--text-secondary); max-width: 460px; margin-bottom: 36px; }
.suggestion-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 600px; }
.chip {
  padding: 10px 16px; background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 50px; color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif; font-size: 13px;
  cursor: pointer; transition: all 0.25s; white-space: nowrap;
}
.chip:hover {
  background: rgba(56,189,248,0.08); border-color: var(--border-accent);
  color: var(--accent); transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Messages list */
.messages-list { display: flex; flex-direction: column; gap: 0; }
.message {
  display: flex; gap: 14px; padding: 14px 24px;
  animation: fadeInUp 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.message.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.message.assistant .msg-avatar {
  background: linear-gradient(135deg, rgba(56,189,248,0.15), rgba(167,139,250,0.15));
  border: 1px solid var(--border-accent);
}
.message.assistant .msg-avatar svg { width: 20px; height: 20px; }
.message.user .msg-avatar {
  background: linear-gradient(135deg, rgba(129,140,248,0.25), rgba(167,139,250,0.25));
  border: 1px solid rgba(129,140,248,0.3);
  color: var(--accent-2); font-family: 'Syne', sans-serif;
  font-size: 13px; font-weight: 700;
}
.msg-body { flex: 1; min-width: 0; }
.msg-name {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 6px; letter-spacing: 0.04em;
}
.message.user .msg-name { text-align: right; }
.msg-content {
  display: inline-block; padding: 12px 16px;
  border-radius: 4px 16px 16px 16px;
  font-size: 14.5px; line-height: 1.7; max-width: 680px;
  background: var(--msg-ai-bg); border: 1px solid var(--msg-ai-border);
  color: var(--text-primary);
}
.message.user .msg-content {
  background: var(--msg-user-bg); border-color: var(--msg-user-border);
  border-radius: 16px 4px 16px 16px; margin-left: auto;
}

/* Markdown */
.msg-content p { margin-bottom: 10px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content ul, .msg-content ol { padding-left: 20px; margin-bottom: 10px; }
.msg-content li { margin-bottom: 4px; }
.msg-content code:not(pre code) {
  background: rgba(56,189,248,0.1); border: 1px solid rgba(56,189,248,0.2);
  border-radius: 5px; padding: 1px 6px; font-size: 13px; color: var(--accent);
}
.msg-content pre {
  background: #0d1117; border: 1px solid var(--border);
  border-radius: 12px; overflow-x: auto; margin: 10px 0;
}
.msg-content pre code { display: block; padding: 14px 16px; font-size: 13px; }
.msg-content strong { color: var(--accent); font-weight: 600; }
.msg-content h1, .msg-content h2, .msg-content h3 { font-family: 'Syne', sans-serif; margin: 12px 0 6px; }
.msg-content blockquote {
  border-left: 3px solid var(--border-accent); padding: 6px 14px;
  margin: 10px 0; color: var(--text-secondary); font-style: italic;
}

/* Typing indicator */
.typing-indicator { display: flex; gap: 5px; padding: 4px 2px; }
.typing-dot {
  width: 7px; height: 7px; border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(1) { background: var(--accent); }
.typing-dot:nth-child(2) { background: var(--accent-2); animation-delay: 0.2s; }
.typing-dot:nth-child(3) { background: var(--accent-3); animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%            { transform: translateY(-8px); opacity: 1; }
}

/* Input */
.input-area {
  padding: 16px 24px 18px;
  background: var(--header-bg); backdrop-filter: blur(16px);
  border-top: 1px solid var(--border); transition: background 0.4s;
}
.input-wrapper {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 18px; padding: 10px 12px;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.input-wrapper:focus-within {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.06), var(--shadow-glow);
}
textarea#userInput {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-family: 'DM Sans', sans-serif;
  font-size: 14.5px; line-height: 1.6; resize: none; max-height: 180px; overflow-y: auto;
}
textarea#userInput::placeholder { color: var(--text-muted); }
.send-btn {
  width: 38px; height: 38px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; border-radius: 10px; color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.25s;
}
.send-btn svg { width: 16px; height: 16px; }
.send-btn:disabled { background: rgba(255,255,255,0.06); cursor: not-allowed; opacity: 0.5; }
.send-btn:not(:disabled):hover { transform: scale(1.08); box-shadow: 0 0 20px rgba(56,189,248,0.3); }
.send-btn:not(:disabled):active { transform: scale(0.95); }
.input-hint { text-align: center; font-size: 11.5px; color: var(--text-muted); margin-top: 10px; }

/* ── Modal ────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; animation: fadeIn 0.2s ease; }
.modal {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px 32px; max-width: 340px; width: 90%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  animation: scaleIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.modal h3 { font-family: 'Syne', sans-serif; font-size: 18px; margin-bottom: 8px; color: var(--text-primary); }
.modal p { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-cancel, .modal-confirm {
  padding: 9px 20px; border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; border: none;
}
.modal-cancel { background: var(--input-bg); color: var(--text-secondary); border: 1px solid var(--border); }
.modal-cancel:hover { background: var(--border); color: var(--text-primary); }
.modal-confirm { background: rgba(251,113,133,0.15); color: #fb7185; border: 1px solid rgba(251,113,133,0.3); }
.modal-confirm:hover { background: rgba(251,113,133,0.25); }

/* ── Keyframes ────────────────────────────────────── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 640px) {
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100%;
    z-index: 50; transform: translateX(-100%);
  }
  .sidebar:not(.collapsed) { transform: translateX(0); }
  .open-sidebar-btn { display: flex !important; }
  .welcome-title { font-size: 26px; }
  .message { padding: 12px 16px; }
  .input-area { padding: 12px 16px 14px; }
  .theme-switcher { display: none; }
  .header-status span:last-child { display: none; }
}
