/* --- Base Variables & Reset --- */
:root {
  --bg-color: #0d1117;
  --card-bg: rgba(22, 27, 34, 0.7);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: #8b949e;
  --primary-glow: #00f0ff;
  /* Fallback */
  --font-main: "Outfit", sans-serif;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  overflow: hidden;
  /* App-like feel */
  height: 100dvh;
}

/* --- Header --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 10;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

#back-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1rem;
}

#back-btn:hover {
  color: #fff;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-3px);
}

.subject-divider {
  color: var(--text-secondary);
  font-weight: 300;
  margin: 0 5px;
}

.current-subject {
  font-weight: 600;
  background: linear-gradient(135deg, #ff0055, #00f0ff);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.3rem;
}

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

.dot {
  width: 8px;
  height: 8px;
  background-color: #00ff9d;
  border-radius: 50%;
  box-shadow: 0 0 10px #00ff9d;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

/* --- Main Layout --- */
.app-container {
  height: 100%;
  width: 100%;
  position: relative;
  background: radial-gradient(circle at 50% 10%, #1a1f2e 0%, #0d1117 80%);
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 80px;
  /* Header space */
  position: relative;
}

/* --- Hero Section --- */
#hero-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 1rem 2rem 2.5rem 2rem;
  transition: all 0.5s ease;
}

.hero-text {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInDown 1s ease;
}

.hero-text h1 {
  font-size: 3.5rem;
  background: linear-gradient(to right, #fff, #a5b4fc);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 900px;
  width: 100%;
  margin-top: auto;
  padding-bottom: 2.5rem; /* lg:pb-10 */
}

/* Responsive adjustments for subject grid */
@media (max-width: 1024px) {
  #hero-section {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
  }
  .subject-grid {
    padding-bottom: 1.5rem; /* md:pb-6 */
    gap: 15px;
  }
  .card {
    padding: 1.5rem 1rem;
  }
  .card i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }
  .card h3 {
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  #hero-section {
    padding: 0.5rem 1rem 1rem 1rem;
  }
  .subject-grid {
    grid-template-columns: repeat(2, 1fr);
    padding-bottom: 1rem; /* pb-4 */
    gap: 10px;
  }
  .card {
    padding: 1.25rem 0.5rem;
  }
  .card i {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
  }
  .card h3 {
    font-size: 0.9rem;
  }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  /* Remove underline for links */
  color: var(--text-primary);
  /* Inherit text color */
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.card i {
  font-size: 2.5rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  transition: color 0.3s ease;
}

.card:hover {
  transform: translateY(-8px);
  border-color: var(--card-color);
  box-shadow:
    0 0 30px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.card:hover i {
  color: var(--card-color);
  filter: drop-shadow(0 0 8px var(--card-color));
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    800px circle at var(--mouse-x) var(--mouse-y),
    rgba(255, 255, 255, 0.06),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.5s;
}

.card:hover::before {
  opacity: 1;
}

/* Subject Card Color Classes (replaces inline styles) */
.card-addmath {
  --card-color: #ff0055;
}

.card-physics {
  --card-color: #00f0ff;
}

.card-biology {
  --card-color: #00ff9d;
}

.card-chemistry {
  --card-color: #d600ff;
}

.card-math {
  --card-color: #ffaa00;
}

.card-sejarah {
  --card-color: #ffee00;
}

/* --- Workspace Section (Chat) --- */
#workspace-section {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0 2rem 2rem 2rem;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scroll-behavior: smooth;
}

/* Message Bubbles */
.user-message,
.ai-message {
  max-width: 80%;
  padding: 1.2rem;
  border-radius: 12px;
  position: relative;
  animation: slideIn 0.3s ease;
  line-height: 1.6;
}

.user-message {
  align-self: flex-end;
  background: linear-gradient(135deg, #2b313e 0%, #161b22 100%);
  border: 1px solid var(--glass-border);
  color: #fff;
}

.ai-message {
  align-self: flex-start;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  display: flex;
  gap: 15px;
}

.ai-message.welcome {
  border-left: 3px solid #00f0ff;
}

.avatar {
  width: 35px;
  height: 35px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00f0ff;
}

/* ===== MARKDOWN STYLING FOR AI MESSAGES ===== */
.ai-message .content {
  flex: 1;
  overflow-wrap: break-word;
  word-break: break-word;
}

.ai-message .content strong,
.ai-message .content b {
  font-weight: 700;
  color: #00f0ff;
}

.ai-message .content em,
.ai-message .content i {
  font-style: italic;
  color: #b8c4ce;
}

.ai-message .content ul,
.ai-message .content ol {
  margin: 10px 0;
  padding-left: 25px;
}

.ai-message .content li {
  margin: 5px 0;
  line-height: 1.6;
}

.ai-message .content p {
  margin: 8px 0;
}

.ai-message .content code {
  background: rgba(0, 240, 255, 0.1);
  color: #00f0ff;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Fira Code", "Consolas", monospace;
  font-size: 0.9em;
}

.ai-message .content pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 10px 0;
}

.ai-message .content pre code {
  background: transparent;
  padding: 0;
  color: #e8e8e8;
}

.ai-message .content blockquote {
  border-left: 3px solid #00f0ff;
  padding-left: 15px;
  margin: 10px 0;
  color: #b8c4ce;
  font-style: italic;
}

.ai-message .content h1,
.ai-message .content h2,
.ai-message .content h3,
.ai-message .content h4 {
  color: #fff;
  margin: 15px 0 10px 0;
}

.ai-message .content h1 {
  font-size: 1.5em;
}

.ai-message .content h2 {
  font-size: 1.3em;
}

.ai-message .content h3 {
  font-size: 1.15em;
}

.ai-message .content a {
  color: #00f0ff;
  text-decoration: underline;
}

.ai-message .content a:hover {
  color: #fff;
}

.ai-message .content hr {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 15px 0;
}

/* Key Answer Highlighting - for textbook definitions */
.ai-message .content .key-answer {
  font-weight: 700;
  font-size: 1.15em;
  color: #00f0ff;
  display: inline;
  background: rgba(0, 240, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

.content img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 10px;
  border: 1px solid var(--glass-border);
}

/* --- Input Area --- */
.input-area {
  position: relative;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.preview-container {
  position: absolute;
  bottom: 70px;
  left: 0;
  max-height: 150px;
  background: rgba(0, 0, 0, 0.8);
  padding: 5px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
}

.preview-container img {
  height: 140px;
  border-radius: 4px;
}

#clear-image {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #ff0055;
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
}

.input-bar {
  display: flex;
  align-items: center;
  background: #161b22;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  /* Capsule shape */
  padding: 8px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s;
}

.input-bar:focus-within {
  border-color: var(--primary-glow, #00f0ff);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  padding: 8px;
  cursor: pointer;
  transition: color 0.3s;
}

.icon-btn:hover {
  color: #fff;
}

#text-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  padding: 10px;
  font-size: 1rem;
  outline: none;
}

.send-btn {
  background: var(--text-primary);
  color: #000;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
}

.send-btn:hover {
  transform: scale(1.1);
}

/* --- Camera Modal --- */
#camera-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}

.camera-content {
  position: relative;
  width: 90%;
  max-width: 600px;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

#camera-stream {
  width: 100%;
  display: block;
}

.camera-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  background: #161b22;
}

.glow-btn {
  background: #fff;
  border: none;
  padding: 10px 30px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.text-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  text-decoration: underline;
}

/* Utilities */
.hidden {
  display: none !important;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Markdown Styling */
.content h1,
.content h2 {
  margin-top: 10px;
  font-size: 1.2rem;
  color: #fff;
}

.content p {
  margin-bottom: 10px;
}

.content code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
}

/* TABLE STYLING FOR MARKDOWN */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.content table th,
.content table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.content table th {
  background: rgba(0, 240, 255, 0.1);
  color: #00f0ff;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.content table tr:last-child td {
  border-bottom: none;
}

.content table tr:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Image Placeholder Styling */
.content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin: 10px 0;
}

.content img[alt*="Diagram"] {
  /* Style broken diagram links or placeholders if needed */
  min-height: 50px;
  background: #1a1a1a;
  display: block;
}

/* --- Logic Terminal --- */
.logic-terminal {
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid #333;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  overflow: hidden;
  animation: fadeInDown 0.3s ease;
  width: 100%;
}

.terminal-header {
  background: #1f1f1f;
  padding: 5px 10px;
  border-bottom: 1px solid #333;
  color: var(--text-secondary);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.terminal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terminal-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.3s;
  font-size: 0.75rem;
}

.terminal-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-glow);
}

.terminal-body {
  padding: 10px;
  color: #00ff00;
  /* Terminal Green */
  max-height: 400px;
  overflow-y: auto;
  transition: all 0.3s ease;
}

/* Collapsed state */
.logic-terminal.collapsed .terminal-body {
  max-height: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
}

.logic-terminal.collapsed {
  margin-bottom: 0.25rem;
}

.logic-terminal.collapsed .terminal-header {
  border-bottom: none;
  opacity: 0.7;
}

.logic-terminal.collapsed:hover .terminal-header {
  opacity: 1;
  background: #2a2a2a;
}

.log-entry {
  margin-bottom: 4px;
}

.log-entry .key {
  color: var(--primary-glow);
  opacity: 0.8;
}

.log-entry .val {
  color: #fff;
}

.log-entry .val.active {
  color: #ff0055;
  font-weight: bold;
}

.cursor-line {
  color: #00ff00;
  margin-top: 5px;
  animation: blink 1s infinite;
}

@keyframes blink {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

/* Resources List Styling */
.logic-terminal .resources-list {
  margin-top: 0.5rem;
}

.logic-terminal .resources-list ul {
  margin: 0.25rem 0 0 1.5rem;
  padding: 0;
  list-style: none;
  font-size: 0.75rem;
  color: #00ff9d;
}

.logic-terminal .resources-list li {
  margin: 0.1rem 0;
  font-family: "Courier New", monospace;
}

.logic-terminal .resources-list li::before {
  content: "├─ ";
  color: #666;
}

.logic-terminal .resources-list li:last-child::before {
  content: "└─ ";
}

.logic-terminal .val.error {
  color: #ff4444;
  font-weight: bold;
}

/* ============================================
   MATHJAX MATHEMATICAL FORMULA STYLING
   Make formulas BIG, CLEAR, and PROMINENT
   ============================================ */

/* Block/Display Math (centered, large equations) */
mjx-container[jax="CHTML"][display="true"],
mjx-container[display="block"] {
  font-size: 160% !important;
  /* Make display equations HUGE */
  margin: 2rem 0 !important;
  /* Big spacing top and bottom */
  color: #e0e7ff !important;
  /* Light indigo for high visibility */
  text-align: center !important;
  display: block !important;
  overflow-x: auto;
  padding: 1rem;
  background: rgba(99, 102, 241, 0.05);
  /* Subtle indigo background */
  border-radius: 8px;
  border-left: 4px solid #818cf8;
  /* Accent border */
}

/* Inline Math (within text) */
mjx-container[jax="CHTML"]:not([display="true"]),
mjx-container:not([display="block"]) {
  font-size: 120% !important;
  /* Slightly bigger than text */
  color: #c7d2fe !important;
  /* Light indigo */
  font-weight: 500;
  padding: 0 4px;
}

/* Math symbols get extra emphasis */
mjx-math {
  color: inherit !important;
}

/* Fractions should be very clear */
mjx-frac {
  margin: 0 4px;
}

/* Matrix and similar structures */
mjx-mtable {
  margin: 8px auto;
}

/* Ensure math doesn't break layout */
mjx-container {
  max-width: 100%;
  overflow-x: auto;
}

/* Special highlighting for important formulas in AI responses */
.ai-message mjx-container[display="true"],
.ai-message mjx-container[display="block"] {
  background: rgba(99, 102, 241, 0.08);
  border-left-color: #a5b4fc;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

/* User messages math (slightly different color) */
.user-message mjx-container {
  color: #fde68a !important;
  /* Warm yellow for user math */
}

.user-message mjx-container[display="true"],
.user-message mjx-container[display="block"] {
  background: rgba(251, 191, 36, 0.05);
  border-left-color: #fbbf24;
}

/* ==============================================
   MOBILE RESPONSIVE STYLES
   Target: screens ≤768px (phones and small tablets)
   Desktop layout is COMPLETELY unchanged above this point
   ============================================== */

@media (max-width: 768px) {
  /* --- Header Optimization --- */
  header {
    padding: 0.75rem 1rem;
    flex-wrap: nowrap;
    gap: 8px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-color);
    border-bottom: 1px solid var(--glass-border);
  }

  .logo {
    font-size: 1rem;
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
  }

  /* Hide "SPM AI Guru" text on mobile, keep icon and subject */
  .logo > span:first-of-type {
    display: none;
  }

  .subject-divider {
    display: none;
  }

  .current-subject {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }

  .header-right {
    flex-shrink: 0;
    gap: 8px;
    display: flex;
    align-items: center;
  }

  /* Hide "Online" text, keep dot only */
  .status {
    font-size: 0;
    gap: 0;
    margin-right: -4px;
  }

  .status .dot {
    width: 6px;
    height: 6px;
  }

  /* Compact auth buttons */
  .auth-section {
    gap: 6px;
    display: flex;
    align-items: center;
  }

  .auth-btn {
    padding: 6px;
    font-size: 1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Hide text in login button, keep Google icon */
  .auth-btn i + span,
  .auth-btn span:not(:only-child) {
    display: none;
  }

  #back-btn,
  #hub-trigger-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    padding: 0;
  }

  /* --- Main Layout --- */
  main {
    padding-top: 55px;
    /* Smaller fixed header */
  }

  /* --- Hero Section (Home Screen) --- */
  #hero-section {
    padding: 1rem;
    height: auto;
    min-height: calc(100vh - 55px);
  }

  .hero-text {
    margin-bottom: 1.5rem;
  }

  .hero-text h1 {
    font-size: 2rem;
    line-height: 1.2;
  }

  .hero-text p {
    font-size: 0.9rem;
  }

  /* 2-column grid for subject cards */
  .subject-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 100%;
    padding: 0;
  }

  .card {
    padding: 1.25rem 1rem;
    border-radius: 12px;
  }

  .card i {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
  }

  .card h3 {
    font-size: 0.9rem;
  }

  /* --- Workspace Section (Chat) --- */
  #workspace-section {
    padding: 0 0.5rem 80px 0.5rem;
    /* Extra bottom padding for fixed input */
    height: calc(100vh - 55px);
  }

  .chat-container {
    padding: 0.5rem;
    margin-bottom: 0;
    border-radius: 8px;
    background: transparent;
  }

  /* --- Message Bubbles --- */
  .user-message,
  .ai-message {
    max-width: 92%;
    padding: 0.9rem;
    font-size: 0.92rem;
    line-height: 1.5;
    border-radius: 10px;
  }

  .ai-message {
    gap: 10px;
  }

  .avatar {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  .content {
    min-width: 0;
    /* Allow text wrapping */
  }

  /* --- Fixed Bottom Input Bar --- */
  .input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 0.75rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0));
    /* iOS safe area */
    background: var(--bg-color);
    border-top: 1px solid var(--glass-border);
    z-index: 50;
    max-width: 100%;
    margin: 0;
  }

  .input-bar {
    padding: 6px 12px;
    border-radius: 22px;
  }

  #text-input {
    font-size: 16px;
    /* Prevent iOS auto-zoom on focus */
    padding: 8px 6px;
  }

  .icon-btn {
    padding: 6px;
    font-size: 1rem;
  }

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

  /* Tools dropdown on mobile */
  .tools-dropdown {
    bottom: 100%;
    left: 0;
    right: auto;
    max-width: 90vw;
  }

  /* Image preview above fixed input */
  .preview-container {
    bottom: 55px;
    left: 5px;
    max-height: 100px;
  }

  .preview-container img {
    height: 90px;
  }

  /* --- Logic Terminal / Thinking Box --- */
  .logic-terminal {
    font-size: 0.75rem;
  }

  .terminal-body {
    padding: 8px;
    max-height: 250px;
  }

  /* --- MathJax on Mobile --- */
  mjx-container[jax="CHTML"][display="true"],
  mjx-container[display="block"] {
    font-size: 130% !important;
    margin: 1rem 0 !important;
    padding: 0.75rem;
  }

  /* --- Settings Modal --- */
  .modal-content.settings-modal {
    width: 95%;
    max-width: 95vw;
    max-height: 85vh;
    margin: 8vh auto;
    padding: 1rem;
  }

  .modal-header h2 {
    font-size: 1.1rem;
  }

  .settings-section label {
    font-size: 0.9rem;
  }

  .note-field textarea {
    font-size: 0.85rem;
  }

  /* --- Camera Modal --- */
  .camera-content {
    width: 95%;
    max-width: 95vw;
  }

  /* --- Visualizer Modal --- */
  .visualizer-viewer {
    padding: 0;
  }

  .viewer-header {
    padding: 0.5rem 1rem;
  }

  .viewer-title span {
    font-size: 0.9rem;
  }

  .video-controls {
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem;
  }

  .timeline-wrapper {
    order: -1;
    width: 100%;
    margin-bottom: 0.25rem;
  }

  .time-display {
    font-size: 0.75rem;
  }

  .ctrl-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .speed-select {
    padding: 4px 6px;
    font-size: 0.8rem;
  }

  /* --- Visualizer Loading Overlay --- */
  .visualizer-loading .loading-content h2 {
    font-size: 1rem;
    padding: 0 1rem;
  }

  /* --- Toast Notifications --- */
  .toast-container {
    bottom: 90px;
    /* Above fixed input bar */
    left: 0.5rem;
    right: 0.5rem;
  }
}

/* Extra small screens (iPhone SE, etc) */
@media (max-width: 375px) {
  .hero-text h1 {
    font-size: 1.7rem;
  }

  .subject-grid {
    gap: 8px;
  }

  .card {
    padding: 1rem 0.75rem;
  }

  .card i {
    font-size: 1.5rem;
  }

  .card h3 {
    font-size: 0.8rem;
  }

  .current-subject {
    max-width: 80px;
    font-size: 0.85rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   WOW FACTOR #1: TYPEWRITER EFFECT (Cyberpunk Blinking Cursor)
   ═══════════════════════════════════════════════════════════════════ */

/* AI message currently streaming - show typing cursor */
.ai-message.typing .content::after {
  content: "▊";
  color: #00f0ff;
  animation: typewriter-blink 0.6s infinite;
  margin-left: 2px;
  font-weight: bold;
  text-shadow: 0 0 8px #00f0ff;
}

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

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

/* Smooth text reveal animation for each character */
.ai-message.typing .content {
  animation: glow-pulse 0.5s ease-out;
}

@keyframes glow-pulse {
  0% {
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  }

  100% {
    text-shadow: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   WOW FACTOR #2: 3D TILT HOVER EFFECT (Floating Cards)
   ═══════════════════════════════════════════════════════════════════ */

/* Container perspective for 3D effect */
.subject-grid {
  perspective: 1000px;
}

/* Cards transform origin and smooth transition */
.card {
  transform-style: preserve-3d;
  transition:
    all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    transform 0.15s ease-out;
}

/* Tilt highlight gradient overlay */
.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%,
    rgba(0, 0, 0, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: 16px;
}

.card:hover::after {
  opacity: 1;
}

/* Floating shadow on hover */
.card.tilting {
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(var(--card-color-rgb, 0, 240, 255), 0.2);
}

/* ═══════════════════════════════════════════════════════════════════
   WOW FACTOR #3: RIPPLE CLICK EFFECT (Material Tactile Feedback)
   ═══════════════════════════════════════════════════════════════════ */

/* Buttons with ripple effect */
.ripple-btn {
  position: relative;
  overflow: hidden;
}

/* The ripple circle */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: ripple-expand 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes ripple-expand {
  0% {
    transform: scale(0);
    opacity: 0.6;
  }

  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* Subject card ripple (cyan glow) */
.card .ripple {
  background: radial-gradient(
    circle,
    rgba(0, 240, 255, 0.5) 0%,
    transparent 70%
  );
}

/* Send button ripple (white glow) */
.send-btn .ripple {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.3) 0%, transparent 70%);
}

/* Header button ripple */
.auth-btn .ripple,
.icon-btn .ripple {
  background: radial-gradient(
    circle,
    rgba(0, 240, 255, 0.4) 0%,
    transparent 70%
  );
}

/* --- Drag and Drop Overlay --- */
.drop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 16, 32, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.drop-overlay-content {
  text-align: center;
  padding: 60px;
  border: 3px dashed var(--primary-glow);
  border-radius: 24px;
  background: rgba(0, 240, 255, 0.05);
  animation: dropPulse 1.5s ease-in-out infinite;
}

.drop-overlay-content i {
  font-size: 64px;
  color: var(--primary-glow);
  margin-bottom: 20px;
  animation: dropBounce 0.5s ease-in-out;
}

.drop-overlay-content p {
  font-size: 1.4rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

@keyframes dropPulse {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.5);
    transform: scale(1.02);
  }
}

@keyframes dropBounce {
  0% {
    transform: translateY(-20px);
  }

  100% {
    transform: translateY(0);
  }
}

/* --- Multi-Image Preview Container --- */
.preview-container {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  background: rgba(22, 27, 34, 0.95);
  border-top: 1px solid var(--glass-border);
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  /* Scrollbar hiding for cleaner look */
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.preview-container.hidden {
  display: none;
}

.preview-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  flex-grow: 1;
  padding-bottom: 4px;
  /* for scrollbar */
}

.thumbnail-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: #000;
  transition: transform 0.2s;
  cursor: pointer;
}

.thumbnail-wrapper:hover {
  transform: scale(1.05);
  border-color: var(--primary-glow);
}

.thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-wrapper .remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.thumbnail-wrapper:hover .remove-btn {
  opacity: 1;
}

.thumbnail-wrapper .remove-btn:hover {
  background: #ff4444;
}

/* Clear All Button */
.preview-container .clear-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s;
}

.preview-container .clear-btn:hover {
  background: rgba(255, 68, 68, 0.1);
  color: #ff4444;
  border-color: #ff4444;
}

/* Hidden legacy img */
#image-preview.hidden {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════
   QUIZ MODE STYLES (Adaptive & Premium)
   ═══════════════════════════════════════════════════════════════════ */

.quiz-card {
  background: rgba(22, 27, 34, 0.8);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  margin-top: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  animation: slideInUp 0.4s ease-out;
}

.quiz-header {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.1), transparent);
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.quiz-topic {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.quiz-difficulty {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.quiz-difficulty.easy {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
  border: 1px solid #4ade80;
}

.quiz-difficulty.medium {
  background: rgba(250, 204, 21, 0.2);
  color: #facc15;
  border: 1px solid #facc15;
}

.quiz-difficulty.hard {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
  border: 1px solid #f87171;
}

.quiz-question {
  padding: 20px;
  font-size: 1.1rem;
  line-height: 1.6;
  color: #fff;
  font-weight: 500;
  margin: 0;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 20px 20px 20px;
}

.quiz-option {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
  position: relative;
}

.quiz-option:hover:not(.disabled) {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--primary-color);
  transform: translateX(5px);
}

.quiz-option.selected {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--primary-color);
}

.quiz-option.correct {
  background: rgba(74, 222, 128, 0.2) !important;
  border-color: #4ade80 !important;
  color: #fff !important;
  box-shadow: 0 0 15px rgba(74, 222, 128, 0.3);
}

.quiz-option.wrong {
  background: rgba(248, 113, 113, 0.2) !important;
  border-color: #f87171 !important;
  color: #fff !important;
  opacity: 0.7;
}

.quiz-option.disabled {
  cursor: default;
  pointer-events: none;
}

.quiz-feedback {
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  animation: fadeIn 0.3s ease-out;
}

.quiz-explanation-title {
  font-weight: 700;
  margin-bottom: 5px;
  color: #fff;
}

.quiz-explanation-text {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
  margin-bottom: 15px;
}

.quiz-next-btn {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: #000;
  font-weight: 700;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.2s;
  box-shadow: 0 5px 15px rgba(0, 240, 255, 0.3);
}

.quiz-next-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 240, 255, 0.5);
}

/* Loader for Quiz */
.quiz-loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--primary-color);
}

.quiz-loader {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 240, 255, 0.3);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

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

/* ========================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ======================================== */

/* Mobile Menu Button - Hidden by default, visible only on mobile */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1001;
  background: rgba(15, 16, 32, 0.95);
  border: 1px solid rgba(0, 255, 255, 0.4);
  border-radius: 10px;
  padding: 14px 18px;
  color: #00ffff;
  font-size: 1.3rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 255, 255, 0.2);
}

.mobile-menu-btn:hover {
  background: rgba(0, 255, 255, 0.15);
  border-color: #00ffff;
  transform: scale(1.05);
}

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

/* ===== MOBILE DEVICES (<= 768px) ===== */
@media screen and (max-width: 768px) {
  /* Show hamburger menu */
  .mobile-menu-btn {
    display: block;
  }

  /* Adjust base font size for readability */
  html {
    font-size: 16px;
  }

  /* Hide sidebar by default on mobile */
  .workspace-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1000;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  /* Show sidebar when active */
  .workspace-sidebar.mobile-active {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
  }

  /* Expand chat area to full width */
  .chat-area {
    width: 100% !important;
    margin-left: 0 !important;
  }

  /* Adjust header padding */
  header {
    padding: 1rem;
  }

  /* Make chat bubbles wider on mobile */
  .ai-message,
  .user-message {
    max-width: 95%;
  }

  .ai-message .content,
  .user-message .content {
    font-size: 1rem;
  }

  /* Adjust workspace section padding */
  #workspace-section {
    padding: 0 1rem 1rem 1rem;
  }

  /* Make input bar touch-friendly */
  .input-bar {
    padding: 10px 14px;
    border-radius: 20px;
  }

  /* Larger touch targets for buttons */
  .icon-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 1.3rem;
  }

  /* Subject grid becomes single column on mobile */
  .subject-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 0 1rem;
  }

  /* Hero text sizing */
  .hero-text h1 {
    font-size: 2.5rem;
  }

  /* Card sizing */
  .card {
    padding: 1.5rem;
  }

  /* Hide desktop-only elements */
  .desktop-only {
    display: none !important;
  }
}

/* ===== TABLET DEVICES (769px - 1024px) ===== */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  /* Keep sidebar visible but narrower */
  .workspace-sidebar {
    width: 220px;
  }

  .chat-area {
    margin-left: 220px;
  }

  /* Subject grid 2 columns */
  .subject-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Adjust font sizes */
  .hero-text h1 {
    font-size: 3rem;
  }
}

/* ===== DESKTOP (> 1024px) ===== */
/* No changes needed - current styles apply */

/* ===== LANDSCAPE MOBILE DEVICES ===== */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .hero-text h1 {
    font-size: 2rem;
  }

  .chat-container {
    max-height: 60vh;
  }
}

/* ===== HIDE MOBILE MENU ON DESKTOP ===== */
@media screen and (min-width: 769px) {
  .mobile-menu-btn {
    display: none !important;
  }

  /* Ensure sidebar is always visible on desktop */
  .workspace-sidebar {
    transform: translateX(0) !important;
  }
}

/* ===== PREVENT HORIZONTAL SCROLL ON MOBILE ===== */
@media screen and (max-width: 768px) {
  body,
  html {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .app-container {
    max-width: 100vw;
    overflow-x: hidden;
  }
}

/* ========================================
   SCROLLBAR STYLING - DARK MODE
   ======================================== */

/* Custom Dark Scrollbar (Webkit - Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
  /* No white background */
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* ========================================
   FIX HORIZONTAL OVERFLOW ISSUES
   ======================================== */

/* Prevent horizontal scroll globally */
body,
html {
  overflow-x: hidden;
  max-width: 100vw;
}

.app-container {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Chat container should not overflow */
.chat-container {
  overflow-x: hidden;
  overflow-y: auto;
  max-width: 100%;
}

/* Ensure message content doesn't overflow */
.ai-message .content,
.user-message .content {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  overflow-x: hidden;
}

/* Code blocks should scroll if needed, not overflow */
.ai-message .content pre {
  overflow-x: auto;
  max-width: 100%;
}

/* Images shouldn't cause overflow */
.content img {
  max-width: 100%;
  height: auto;
}

/* Math formulas shouldn't overflow */
mjx-container {
  max-width: 100%;
  overflow-x: auto;
}

/* ========================================
   PROFILE MODAL STYLING
   ======================================== */
.profile-modal {
  max-width: 400px;
  text-align: center;
}

.profile-header-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.profile-pic-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid #00f0ff;
  margin-bottom: 1rem;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.profile-header-large h3 {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 0.5rem;
}

.profile-email {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.profile-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s;
}

.profile-action-btn.logout {
  background: rgba(255, 50, 50, 0.1);
  color: #ff4444;
  border: 1px solid rgba(255, 50, 50, 0.3);
}

.profile-action-btn.logout:hover {
  background: rgba(255, 50, 50, 0.2);
  box-shadow: 0 0 15px rgba(255, 50, 50, 0.2);
}

/* ========================================
   MOBILE OPTIMIZATIONS (USER REQUESTED)
   ======================================== */
@media screen and (max-width: 768px) {
  /* 1. Hide Hamburger Menu (User requested removal) */
  .mobile-menu-btn {
    display: none !important;
  }

  /* 2. Header Optimizations */
  /* Show App Name/Logo */
  .logo span {
    display: inline-block !important;
    font-size: 1.1rem;
  }

  /* Hide User Name in Header (Avatar Only) */
  .user-name {
    display: none !important;
  }

  /* Simplify Profile Section */
  .user-profile {
    padding: 0;
    background: none;
    border: none;
  }

  .user-profile:active {
    transform: scale(0.95);
  }

  /* 3. Thinner Subject Cards */
  .subject-grid {
    gap: 10px;
    /* Tighter gap */
  }

  .card {
    padding: 0.8rem 1.2rem !important;
    /* Reduced padding for "thinner" look */
    min-height: auto;
    display: flex;
    flex-direction: row;
    /* Horizontal layout */
    align-items: center;
    justify-content: flex-start;
    /* Left align content */
    text-align: left;
    gap: 15px;
  }

  .card i {
    font-size: 1.5rem !important;
    /* Smaller icons */
    margin-bottom: 0 !important;
  }

  .card h3 {
    font-size: 1rem;
    margin: 0;
  }
}

/* ========================================
   CHATGPT STYLE UI OVERRIDES (BORDERLESS)
   ======================================== */

/* ========================================
   CHATGPT STYLE UI OVERRIDES (BORDERLESS & COMPACT)
   ======================================== */

/* 1. Header Cleanup - EXACT Body Match */
header {
  background-color: var(--bg-color) !important;
  /* #0d1117 - Solid Match */
  border-bottom: none !important;
  box-shadow: none !important;
  padding: 0.5rem 1rem !important;
  /* Reduced height */
  height: 60px;
  /* Fixed compact height */
  /* Ensure flex layout starts everything from LEFT */
  display: flex !important;
  justify-content: flex-start !important;
  /* Stick to LEFT */
  align-items: center !important;
  gap: 15px !important;
  /* Space between Title group and Button group */
}

.logo {
  text-shadow: none !important;
  flex-grow: 0 !important;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Header Right Group */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  /* Space between Fullscreen, Settings, Avatar */
}

/* User Profile - Clean Look */
.user-profile {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  gap: 0;
  /* Avatar handles its own space */
}

.profile-pic {
  border: none !important;
  box-shadow: none !important;
  width: 36px;
  height: 36px;
}

/* 2. Chat Container & Input - Floating Feel */
.chat-container {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Remove the "thin line" above input area */
.input-area,
.chat-input-area {
  background: transparent !important;
  border-top: none !important;
  /* Key fix */
  box-shadow: none !important;
  padding: 10px 1rem !important;
}

/* Floating Pill Input */
.input-bar {
  background: #1e1e1e;
  /* Darker clean pill */
  border: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  border-radius: 30px !important;
  padding: 8px 15px;
}

.input-bar:focus-within {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  background: #252525;
}

#text-input {
  color: #ececec;
}

/* Remove Tools Menu Borders */
/* Remove Tools Menu Borders */
.tools-menu-wrapper button,
button.auth-btn {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* 3. Mobile Optimizations - Maximizing Space */
@media screen and (max-width: 768px) {
  /* 1. Header Cleanup - EXACT Body Match */
  header {
    background-color: var(--bg-color) !important;
    /* #0d1117 - Solid Match */
    border-bottom: none !important;
    box-shadow: none !important;
    padding: 0.5rem 1rem !important;
    /* Reduced height */
    height: 60px;
    /* Fixed compact height */
    /* Mobile Layout: Back/Title (Left) <--- SPACE ---> Tools/Avatar (Right) */
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    /* Ensure full width */
  }

  .logo {
    font-size: 1.1rem;
    flex-grow: 0 !important;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    margin-right: 0 !important;
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto !important;
    /* FORCE PUSH TO RIGHT */
  }

  /* Reduce button sizes */
  .auth-btn,
  #fullscreen-btn,
  #settings-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 1rem;
  }

  /* STRICTLY Hide User Name - AGGRESSIVE FIX */
  header .user-profile .user-name,
  .user-profile span,
  .user-profile .user-name-text {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    visibility: hidden !important;
    position: absolute !important;
  }

  /* Make Subject Title White & Clean */
  .current-subject {
    color: #fff !important;
    background: none !important;
    -webkit-text-fill-color: #fff !important;
    font-size: 1.1rem !important;
    margin-left: 5px !important;
  }

  /* Back Button floating */
  #back-btn {
    background: transparent !important;
    border: none !important;
    padding: 0;
    width: auto;
  }

  /* Input Bar Compactness */
  .input-bar {
    border-radius: 25px !important;
    margin: 0;
  }

  /* Hide Status */
  .status {
    display: none !important;
  }
}

/* Global Header Desktop Fixes */
/* 1. Remove "Online" Status */
.status-indicator {
  display: none !important;
}

/* 2. Force Tools to Far Right */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-right {
  margin-left: auto !important;
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Mermaid Mindmap Container */
.mermaid {
  width: 100%;
  overflow: auto;
  /* Enable scrolling for large maps */
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-top: 15px;
  min-height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Mermaid Mindmap Container */
.mermaid {
  width: 100%;
  overflow: auto;
  /* Enable scrolling for large maps */
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-top: 15px;
  min-height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}
