/* ==========================================================================
   ALPHA AYESHA - AI Math Assistant of My Maths Club
   ChatGPT-inspired Ultra-Modern Theme with Math Tutoring Enhancements
   ========================================================================== */

:root {
  /* ChatGPT Classic Dark Palette with Math Club Accents */
  --bg-main: #212121;
  --bg-sidebar: #171717;
  --bg-card: #2f2f2f;
  --bg-card-hover: #3a3a3a;
  --bg-input: #2f2f2f;
  --bg-code: #141416;
  --border-color: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.07);
  
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-muted: #8e8e8e;
  
  /* Brand Accents - Inspired by Alpha Ayesha's Golden-Cyan Sacred Geometry */
  --brand-primary: #10a37f;        /* Classic ChatGPT Mint */
  --brand-accent: #f59e0b;         /* Maths Club Golden Amber */
  --brand-glow: rgba(245, 158, 11, 0.25);
  --brand-cyan: #06b6d4;           /* Vector Calculus Cyan */
  --brand-purple: #8b5cf6;         /* Geometry Violet */
  --danger: #ef4444;
  --success: #10b981;

  --sidebar-width: 270px;
  --header-height: 56px;
  --input-max-width: 820px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-math: 'KaTeX_Math', 'Times New Roman', serif;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-main: #ffffff;
  --bg-sidebar: #f9f9f9;
  --bg-card: #f4f4f5;
  --bg-card-hover: #e4e4e7;
  --bg-input: #f4f4f5;
  --bg-code: #f1f5f9;
  --border-color: rgba(0, 0, 0, 0.12);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --brand-glow: rgba(245, 158, 11, 0.15);
}

/* OLED / Cyberpunk Midnight Theme */
[data-theme="midnight"] {
  --bg-main: #0a0a0f;
  --bg-sidebar: #050508;
  --bg-card: #12121a;
  --bg-card-hover: #1c1c28;
  --bg-input: #12121a;
  --bg-code: #07070c;
  --border-color: rgba(6, 182, 212, 0.2);
  --border-subtle: rgba(245, 158, 11, 0.15);
  --brand-glow: rgba(6, 182, 212, 0.3);
}

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

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* Typography refinement: Prevent overly bold text & align with ChatGPT aesthetics */
b, strong {
  font-weight: 600;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* App Layout Grid */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   SIDEBAR (ChatGPT Style)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition-normal), width var(--transition-normal);
  z-index: 50;
  position: relative;
}

.sidebar.collapsed {
  transform: translateX(-100%);
  width: 0 !important;
  min-width: 0 !important;
  border-right: none;
  overflow: hidden;
  pointer-events: none;
}

/* Sidebar Toggle / Collapse Button inside Sidebar Header (ChatGPT Style) */
.btn-close-sidebar {
  display: flex;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-close-sidebar:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

/* Mobile & Tablet Drawer Backdrop Overlay (ChatGPT Style) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition-normal);
  pointer-events: none;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.sidebar-header {
  padding: 14px 14px 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.club-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.club-emblem {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--brand-accent);
  box-shadow: 0 0 10px var(--brand-glow);
}

.club-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.club-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #fff;
  white-space: nowrap;
}

.bot-tagline {
  font-size: 11px;
  color: var(--brand-accent);
  font-weight: 600;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background-color: var(--success);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px var(--success);
}

.btn-new-chat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-new-chat:hover {
  background: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-new-chat .btn-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kbd-shortcut {
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--text-muted);
}

/* Sidebar Fast Navigation & Modes */
.sidebar-modes {
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

.sidebar-nav-item:hover, .sidebar-nav-item.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  border-left: 3px solid var(--brand-accent);
}

.sidebar-nav-item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: 0.85;
}

/* Chat History List */
.chat-history-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.history-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  padding: 8px 10px 4px 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  group: true;
  transition: background var(--transition-fast);
  text-decoration: none;
}

.history-item:hover, .history-item.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.history-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  padding-right: 6px;
}

.history-actions {
  display: none;
  align-items: center;
  gap: 4px;
}

.history-item:hover .history-actions {
  display: flex;
}

.btn-icon-subtle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-subtle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

/* Sidebar Footer / Profile */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-profile-card:hover {
  background: var(--bg-card);
}

.user-avatar-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   MAIN CHAT AREA
   ========================================================================== */
.main-content {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-main);
  overflow: hidden;
}

/* Top Navbar */
.top-navbar {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-main);
  z-index: 20;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-toggle-sidebar {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-toggle-sidebar:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

/* Desktop: When sidebar is open, hide navbar toggle button so there is NO overlap with left column */
@media (min-width: 1025px) {
  .app-container:not(.sidebar-collapsed) .top-navbar .btn-toggle-sidebar {
    display: none !important;
  }
}

.model-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.model-selector:hover {
  background: var(--bg-card);
  border-color: var(--border-subtle);
}

.model-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(6, 182, 212, 0.2));
  color: var(--brand-accent);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* Chat Scroll Container */
.chat-scroll-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 30px 16px;
  scroll-behavior: smooth;
}

.chat-inner-width {
  width: 100%;
  max-width: var(--input-max-width);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ==========================================================================
   EMPTY STATE / HERO GREETING (ChatGPT Style)
   ========================================================================== */
.hero-greeting {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 0 20px 0;
  gap: 16px;
  margin: auto 0;
}

.hero-avatar-container {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 6px;
}

.hero-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brand-accent);
  box-shadow: 0 0 24px var(--brand-glow), 0 0 40px rgba(6, 182, 212, 0.2);
  position: relative;
  z-index: 2;
}

.hero-avatar-pulse {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--brand-accent), var(--brand-cyan), var(--brand-purple), var(--brand-accent));
  filter: blur(10px);
  opacity: 0.6;
  z-index: 1;
  animation: spinGlow 12s linear infinite;
}

@keyframes spinGlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.hero-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 580px;
  line-height: 1.6;
}

.hero-math-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.28);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-accent);
}

/* Prompt Suggestion Cards Grid */
.prompt-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 720px;
  margin-top: 16px;
}

.prompt-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.prompt-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.prompt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-accent);
}

.prompt-card-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   CHAT MESSAGES
   ========================================================================== */
.message-row {
  display: flex;
  gap: 16px;
  width: 100%;
  animation: fadeIn 0.25s ease-out;
}

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

.message-row.user {
  justify-content: flex-end;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

.message-avatar.bot {
  border: 1.5px solid var(--brand-accent);
  box-shadow: 0 0 10px var(--brand-glow);
  overflow: hidden;
}

.message-avatar.bot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-avatar.user-avatar {
  background: #3b82f6;
  color: #fff;
}

.message-content {
  flex: 1;
  max-width: calc(100% - 50px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-row.user .message-content {
  align-items: flex-end;
  max-width: 80%;
}

/* ChatGPT-Inspired Message Bubble & Content Typography */
.message-bubble {
  font-size: 16px;
  line-height: 1.75;
  font-weight: 400;
  letter-spacing: -0.011em;
  word-break: break-word;
}

.message-row.user .message-bubble {
  background: #2e3038;
  color: var(--text-primary);
  border-radius: 18px 18px 4px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 18px;
  font-size: 15.5px;
  line-height: 1.65;
  max-width: 100%;
}

[data-theme="light"] .message-row.user .message-bubble {
  background: #f4f4f5;
  color: var(--text-primary);
  border-color: rgba(0, 0, 0, 0.08);
}

.message-row.bot .message-bubble {
  background: transparent;
  color: var(--text-primary);
  padding: 0;
  width: 100%;
  font-size: 16px;
  line-height: 1.75;
}

/* Comprehensive Markdown & Content Typography inside Message Bubble */
.message-bubble p {
  margin-top: 0;
  margin-bottom: 1.25rem;
  line-height: 1.75;
  font-size: 16px;
  color: var(--text-primary);
}

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

.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.message-bubble h1:first-child,
.message-bubble h2:first-child,
.message-bubble h3:first-child,
.message-bubble h4:first-child {
  margin-top: 0;
}

.message-bubble h1 {
  font-size: 1.5rem;
}

.message-bubble h2 {
  font-size: 1.25rem;
}

.message-bubble h3 {
  font-size: 1.125rem;
}

.message-bubble h4 {
  font-size: 1rem;
}

/* Subtle, refined bolding like ChatGPT - avoid heavy harsh bold */
.message-bubble strong,
.message-bubble b {
  font-weight: 600;
  color: var(--text-primary);
}

.message-bubble em,
.message-bubble i {
  font-style: italic;
}

.message-bubble ul,
.message-bubble ol {
  margin-top: 0.25rem;
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  line-height: 1.75;
}

.message-bubble li {
  margin-bottom: 0.35rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.message-bubble li:last-child {
  margin-bottom: 0;
}

.message-bubble li > p {
  margin-bottom: 0.35rem;
}

.message-bubble blockquote {
  border-left: 3px solid rgba(255, 255, 255, 0.25);
  margin: 1.25rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.75;
}

[data-theme="light"] .message-bubble blockquote {
  border-left-color: rgba(0, 0, 0, 0.2);
}

.message-bubble code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-weight: 400;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  color: #e2e8f0;
}

[data-theme="light"] .message-bubble code:not(pre code) {
  background-color: rgba(0, 0, 0, 0.06);
  color: #1e293b;
}

.message-bubble pre {
  margin: 1.25rem 0;
  border-radius: var(--radius-md);
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  line-height: 1.65;
}

.message-bubble pre code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 400;
  display: block;
  padding: 1rem 1.25rem;
  line-height: 1.65;
  color: #e2e8f0;
}

.message-bubble hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.5rem 0;
}

.message-bubble a {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9375rem;
  line-height: 1.65;
}

.message-bubble th,
.message-bubble td {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.message-bubble th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  color: var(--text-primary);
}

[data-theme="light"] .message-bubble th {
  background: rgba(0, 0, 0, 0.03);
}

.bot-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.bot-name-label {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.club-affiliation-tag {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.15);
  color: var(--brand-accent);
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-weight: 500;
}

/* Math Solution Steps & Box formatting */
.step-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--brand-accent);
  border-radius: var(--radius-md);
  margin: 14px 0;
  overflow: hidden;
}

.step-header {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brand-accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.step-body {
  padding: 14px 16px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text-primary);
  border-top: 1px solid var(--border-subtle);
}

.step-body p {
  margin-bottom: 12px;
  line-height: 1.75;
}

.step-body p:last-child {
  margin-bottom: 0;
}

/* Final Answer Highlight Box */
.final-answer-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 16px 0;
  line-height: 1.65;
}

.final-answer-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--success);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Verification Box */
.verification-box {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 13.5px;
  line-height: 1.65;
}

.verification-title {
  color: var(--brand-purple);
  font-weight: 600;
  margin-bottom: 4px;
}

/* Practice Problem / Quiz Card in Chat */
.quiz-chat-card {
  background: var(--bg-card);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 14px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.quiz-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-cyan);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.quiz-option-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-option-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--brand-accent);
}

.quiz-option-btn.correct {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--success);
  color: #fff;
}

.quiz-option-btn.incorrect {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: #fff;
}

/* Math block & KaTeX customizations */
.katex-display {
  margin: 1em 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 0;
}

.math-code-block {
  background: var(--bg-code);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin: 12px 0;
  overflow: hidden;
}

.math-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: var(--text-muted);
}

.math-code-body {
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  overflow-x: auto;
  color: #a5f3fc;
}

/* Message Actions Bar (ChatGPT style) */
.message-actions-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

.action-pill-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  transition: all var(--transition-fast);
}

.action-pill-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.action-pill-btn.active {
  color: var(--brand-accent);
}

/* Typing / Streaming Cursor */
.streaming-cursor {
  display: inline-block;
  width: 6px;
  height: 15px;
  background-color: var(--brand-accent);
  margin-left: 3px;
  vertical-align: middle;
  animation: blink 0.8s infinite;
}

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

/* ==========================================================================
   BOTTOM INPUT CONTAINER (ChatGPT Floating Pill Style)
   ========================================================================== */
.chat-bottom-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px 20px 16px;
  background: linear-gradient(180deg, transparent 0%, var(--bg-main) 30%);
  position: relative;
  z-index: 10;
}

.input-container-width {
  width: 100%;
  max-width: var(--input-max-width);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Math Formula Quick Keys Toolbar */
.math-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  scrollbar-width: none;
}

.math-toolbar::-webkit-scrollbar {
  display: none;
}

.math-key-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-family: var(--font-mono);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.math-key-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--brand-accent);
}

/* Floating Input Box */
.chat-input-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 10px 14px 10px 18px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input-box:focus-within {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.input-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.011em;
  resize: none;
  max-height: 200px;
  min-height: 24px;
  padding: 4px 0;
}

.input-textarea::placeholder {
  color: var(--text-muted);
}

.input-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 2px;
}

.btn-input-tool {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-input-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-input-tool.recording {
  color: var(--danger);
  animation: pulseMic 1.2s infinite;
}

@keyframes pulseMic {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
  100% { transform: scale(1); }
}

.btn-send {
  background-color: var(--text-primary);
  color: var(--bg-main);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-send:hover {
  opacity: 0.9;
  transform: scale(1.04);
}

.btn-send:disabled {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.btn-send.stop-mode {
  background-color: var(--danger);
  color: #fff;
}

.chat-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

/* ==========================================================================
   MODALS & DRAWERS (Grapher, Formulas, Quiz, Settings)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  transform: scale(0.96);
  transition: transform var(--transition-normal);
  overflow: hidden;
}

.modal-backdrop.open .modal-card {
  transform: scale(1);
}

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

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Grapher Modal Specifics */
.grapher-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.grapher-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--brand-cyan);
  font-family: var(--font-mono);
  font-size: 14px;
}

.grapher-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
  background: #111116;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

#graphCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-coord-overlay {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--brand-accent);
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
}

/* Formula Sheet Accordions */
.formula-category {
  margin-bottom: 16px;
}

.formula-cat-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-accent);
  margin-bottom: 8px;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.formula-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.formula-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--brand-accent);
}

.formula-name {
  font-size: 11px;
  color: var(--text-muted);
}

.formula-math {
  font-size: 13.5px;
  color: var(--text-primary);
  margin-top: 2px;
}

/* Settings Window & Left-Side Scrollbar */
#settingsModal form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#settingsModal .modal-body {
  direction: rtl; /* Places scrollbar on the left side of the window */
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-accent) rgba(255, 255, 255, 0.05);
  padding: 20px 20px 20px 14px;
}

#settingsModal .modal-body > * {
  direction: ltr; /* Restores standard left-to-right flow for all content */
  text-align: left;
}

#settingsModal .modal-body::-webkit-scrollbar {
  width: 6px;
}

#settingsModal .modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  margin: 6px 0;
}

#settingsModal .modal-body::-webkit-scrollbar-thumb {
  background: var(--brand-accent);
  border-radius: 999px;
}

#settingsModal .modal-body::-webkit-scrollbar-thumb:hover {
  background: #fbbf24;
}

/* Form Groups in Settings */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--brand-accent);
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Developer-Only Settings Section */
.dev-settings-section {
  margin-top: 18px;
  padding: 16px;
  background: rgba(16, 185, 129, 0.04);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  animation: fadeIn 0.25s ease-out;
}

.dev-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.dev-badge-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #34d399;
  font-size: 13px;
  font-weight: 600;
}

.dev-only-pill {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.dev-unlock-wrapper {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-dev-toggle-unlock {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  width: fit-content;
  transition: all var(--transition-fast);
}

.btn-dev-toggle-unlock:hover {
  color: var(--brand-accent);
}

.dev-quick-unlock-box {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  animation: fadeIn 0.2s ease-out;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--brand-accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(12px);
  transition: all var(--transition-normal);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
  }

  .prompt-cards-grid {
    grid-template-columns: 1fr;
  }

  .formula-grid {
    grid-template-columns: 1fr;
  }

  .chat-scroll-container {
    padding: 12px 10px;
  }
}

/* ==========================================================================
   SNAPSHOT & PDF UPLOAD / SCANNING STYLES
   ========================================================================== */

/* Fullscreen Drag & Drop Overlay */
.file-dropzone-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 13, 18, 0.88);
  backdrop-filter: blur(8px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  border: 3px dashed var(--brand-accent);
}

.file-dropzone-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--bg-card);
  padding: 36px 48px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 32px var(--brand-glow);
  transform: scale(0.95);
  transition: transform var(--transition-fast);
}

.file-dropzone-overlay.active .dropzone-content {
  transform: scale(1);
}

/* Attachment Preview Area (Above Input Box) */
.attachment-preview-area {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  animation: fadeIn 0.2s ease-out;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  max-width: 320px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.attachment-chip-thumb {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  background: #141416;
  flex-shrink: 0;
}

.attachment-chip-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
}

.attachment-chip-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.attachment-chip-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-chip-status {
  font-size: 11px;
  color: var(--brand-accent);
  display: flex;
  align-items: center;
  gap: 4px;
}

.attachment-chip-status.done {
  color: var(--success);
}

.attachment-chip-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.attachment-chip-remove:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Spinner */
.ocr-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(245, 158, 11, 0.2);
  border-top-color: var(--brand-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* Attachment in Chat Message Bubble */
.message-attachment-box {
  margin-bottom: 10px;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
}

.message-attachment-img {
  max-width: 280px;
  max-height: 200px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.message-attachment-img:hover {
  transform: scale(1.02);
}

.message-attachment-pdf {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
}

.scanned-math-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--brand-cyan);
  font-weight: 600;
  margin-bottom: 8px;
}

/* ==========================================================================
   CREATOR CREDIT: MARIA MEHMOOD
   ========================================================================== */
.creator-credit-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(245, 158, 11, 0.1));
  border: 1px solid rgba(236, 72, 153, 0.28);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.creator-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #f59e0b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
}

.creator-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.creator-by {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.creator-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.2px;
}

.creator-role {
  font-size: 10.5px;
  color: #f472b6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   UPLOAD USAGE TRACKER (5 Free Uploads) & UPGRADE MODAL
   ========================================================================== */
.upload-usage-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.upload-usage-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--brand-accent);
}

.usage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.usage-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.usage-counter {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-accent);
}

.usage-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 4px;
}

.usage-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-cyan), var(--brand-accent));
  border-radius: var(--radius-full);
  transition: width 0.3s ease, background 0.3s ease;
}

.usage-progress-fill.full {
  background: var(--danger);
}

.usage-subtext {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Upgrade Navbar Button */
.btn-upgrade-pill {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(236, 72, 153, 0.2)) !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  color: #fbbf24 !important;
  font-weight: 600 !important;
}

.btn-upgrade-pill:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(236, 72, 153, 0.35)) !important;
  box-shadow: 0 0 12px var(--brand-glow);
}

.pro-crown {
  font-size: 14px;
}

/* Upgrade Modal Elements */
.upgrade-modal-card {
  max-width: 580px;
}

.paywall-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.paywall-status-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--danger);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.paywall-heading {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.paywall-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pro-features-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.pro-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-primary);
}

.pro-check {
  width: 20px;
  height: 20px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--success);
  border-radius: 50%;
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
}

.pro-feat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.pricing-card-box {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(236, 72, 153, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.pricing-plan-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.plan-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.plan-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--brand-accent);
  color: #000;
  margin-left: 8px;
}

.plan-price {
  font-size: 24px;
  font-weight: 600;
  color: #fbbf24;
}

.plan-price span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.promo-code-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

/* ==========================================================================
   USER PROFILE & AUTHENTICATION STYLES (Sign In / Sign Up & Pro $20/mo)
   ========================================================================== */

/* Navbar Auth Pill */
.btn-auth-pill {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: var(--text-primary) !important;
  font-weight: 500;
  padding: 6px 12px !important;
  gap: 6px;
  border-radius: var(--radius-full) !important;
}

.btn-auth-pill:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: var(--brand-accent) !important;
}

.auth-avatar-mini {
  font-size: 13px;
  line-height: 1;
}

/* Sidebar User Profile Controls */
.user-profile-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-profile-wrapper .user-profile-card {
  flex: 1;
  margin-bottom: 0;
}

.btn-sidebar-auth {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-sidebar-auth:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border-color: var(--brand-accent);
}

/* ==========================================================================
   CHAT LOCKED BANNER (Exceeded Free Package Limit)
   ========================================================================== */
.chat-locked-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(245, 158, 11, 0.12));
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  animation: slideInUp 0.3s ease-out;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.18);
  backdrop-filter: blur(8px);
}

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

.locked-banner-icon {
  font-size: 24px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
}

.locked-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.locked-banner-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #fca5a5;
  letter-spacing: 0.1px;
}

.locked-banner-desc {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.4;
}

.btn-lock-upgrade {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  border: none;
  border-radius: var(--radius-md);
  color: #000;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  flex-shrink: 0;
}

.btn-lock-upgrade:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.5);
}

/* Chat Input Box in Locked State */
.chat-input-box.locked {
  background-color: rgba(255, 255, 255, 0.02);
  border-color: rgba(239, 68, 68, 0.3);
  cursor: not-allowed;
}

.chat-input-box.locked .input-textarea {
  cursor: not-allowed;
}

.chat-input-box.locked .btn-send {
  background-color: rgba(239, 68, 68, 0.25) !important;
  color: #fca5a5 !important;
  cursor: not-allowed !important;
}

/* ==========================================================================
   AUTH MODAL STYLES (Sign In / Sign Up)
   ========================================================================== */
.auth-modal-card {
  max-width: 500px;
}

.auth-tabs-nav {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
  border: 1px solid var(--border-subtle);
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab-btn.active {
  background: var(--bg-card);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tab-btn:hover:not(.active) {
  color: var(--text-primary);
}

.auth-error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  color: #fca5a5;
  margin-bottom: 16px;
  animation: fadeIn 0.2s ease-out;
}

.free-package-info-pill {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12px;
  color: #a5f3fc;
  margin: 12px 0 6px 0;
  line-height: 1.4;
}

/* Demo Accounts Box */
.demo-accounts-box {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.demo-accounts-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.demo-buttons-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-btn {
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.demo-btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.6);
  transform: translateX(2px);
}

.demo-btn-free {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #86efac;
}

.demo-btn-free:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
  transform: translateX(2px);
}

.demo-btn-pro {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

.demo-btn-pro:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.6);
  transform: translateX(2px);
}

.demo-btn-dev {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(6, 182, 212, 0.16));
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
  font-weight: 500;
}

.demo-btn-dev:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(6, 182, 212, 0.28));
  border-color: rgba(16, 185, 129, 0.75);
  transform: translateX(2px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE SYSTEM (ChatGPT Style Sidebar & Layout)
   ========================================================================== */

@media (max-width: 1024px) {
  /* Hide desktop-only buttons so mobile header stays pristine */
  .nav-btn-desktop-only {
    display: none !important;
  }

  /* Left-side column inside off-canvas drawer just like ChatGPT */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    width: 290px;
    max-width: 85vw;
    z-index: 1000;
    transform: translateX(-100%);
    box-shadow: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* When sidebar drawer is toggled open */
  .sidebar.mobile-open {
    transform: translateX(0) !important;
    width: 290px !important;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 100px rgba(0, 0, 0, 0.5);
  }

  /* On tablet/mobile, collapsed state remains tucked away */
  .sidebar.collapsed {
    transform: translateX(-100%) !important;
    width: 290px !important;
  }

  /* Show toggle/close button inside drawer */
  .btn-close-sidebar {
    display: flex;
  }

  /* Main content expands to full viewport width */
  .main-content {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
  }

  /* Sidebar toggle button on tablet/mobile header */
  .btn-toggle-sidebar {
    display: flex !important;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    padding: 6px;
    border-radius: var(--radius-md);
  }

  .btn-toggle-sidebar:active {
    background: rgba(255, 255, 255, 0.16);
    transform: scale(0.96);
  }

  /* When mobile drawer is open, hide navbar toggle button so it never overlaps or peeks through */
  .sidebar.mobile-open ~ .main-content .btn-toggle-sidebar,
  .app-container.mobile-sidebar-open .top-navbar .btn-toggle-sidebar {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .top-navbar {
    padding: 0 14px;
  }
}

@media (max-width: 768px) {
  /* Mobile Phone Layout */
  .top-navbar {
    padding: 0 10px;
    height: 52px;
  }

  .model-title {
    font-size: 13.5px;
  }

  .model-badge {
    display: none;
  }

  .nav-right {
    gap: 6px;
  }

  .nav-btn {
    padding: 5px 9px;
    font-size: 12px;
  }

  .btn-upgrade-pill span:not(.pro-crown) {
    font-size: 11.5px;
  }

  .chat-scroll-container {
    padding: 10px 10px 145px 10px;
  }

  .chat-inner-width {
    width: 100%;
    padding: 0;
  }

  .message-row {
    padding: 8px 0;
    gap: 8px;
  }

  .message-avatar {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .message-bubble {
    font-size: 14.5px;
    line-height: 1.55;
    padding: 10px 13px;
    max-width: calc(100% - 38px);
    overflow-x: auto;
  }

  /* Floating Bottom Input on Mobile */
  .chat-bottom-wrapper {
    padding: 6px 10px 10px 10px;
  }

  .input-container-width {
    width: 100%;
  }

  .chat-input-box {
    padding: 6px 8px;
    border-radius: 18px;
  }

  .input-textarea {
    font-size: 14.5px;
    max-height: 110px;
  }

  .btn-input-tool, .btn-send {
    width: 32px;
    height: 32px;
  }

  .math-toolbar {
    gap: 4px;
    padding: 4px 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .math-key-btn {
    font-size: 12px;
    padding: 4px 8px;
    min-width: 30px;
  }

  /* Hero Greeting on Mobile */
  .hero-greeting {
    padding: 20px 6px;
  }

  .hero-avatar-container {
    width: 60px;
    height: 60px;
  }

  .hero-title {
    font-size: 24px;
  }

  .hero-subtitle {
    font-size: 12.5px;
    line-height: 1.45;
    margin-bottom: 20px;
  }

  .prompt-cards-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .prompt-card {
    padding: 12px;
  }

  /* Modals on Mobile */
  .modal-card {
    width: 95%;
    max-height: 90vh;
    margin: 8px;
  }

  .modal-body {
    padding: 14px;
  }

  .formula-grid {
    grid-template-columns: 1fr;
  }

  .pro-features-grid {
    grid-template-columns: 1fr;
  }
}



