/* ==========================================================================
   Vidyaverse AI - Premium Dashboard UI Stylesheet
   ========================================================================== */

/* ----------------------------------------------------
   1. Theme Variables & Base Style Resets
   ---------------------------------------------------- */
:root {
  /* Fonts */
  --font-main: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Borders & Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 50px;
}

/* Dark Mode Variables (Default) */
html[data-theme="dark"] {
  --bg-color: #0F172A;
  --surface-color: #1E293B;
  --surface-hover: #334155;
  --border-color: rgba(255, 255, 255, 0.06);
  --border-color-hover: rgba(255, 255, 255, 0.12);
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --color-primary: #3B82F6;
  --color-secondary: #60A5FA;
  --color-accent: #60A5FA;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;

  --primary-gradient: linear-gradient(135deg, #2563EB, #60A5FA);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
  --box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Light Mode Variables */
html[data-theme="light"] {
  --bg-color: #FFFFFF;
  --surface-color: #F8FAFC;
  --surface-hover: #E2E8F0;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(0, 0, 0, 0.15);
  
  --text-primary: #1E293B;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  --color-primary: #2563EB;
  --color-secondary: #60A5FA;
  --color-accent: #3B82F6;
  --color-success: #059669;
  --color-warning: #D97706;
  --color-danger: #DC2626;

  --primary-gradient: linear-gradient(135deg, #2563EB, #3B82F6);
  --glass-bg: rgba(248, 250, 252, 0.8);
  --glass-border: rgba(0, 0, 0, 0.06);
  --box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Global Utilities */
.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
  font-size: 0.95rem;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color-hover);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ----------------------------------------------------
   2. Structural Layout (Fixed Sidebar + Content Canvas)
   ---------------------------------------------------- */
.app-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  background-color: var(--surface-color);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  z-index: 90;
  transition: transform var(--transition-normal), background-color var(--transition-normal);
}

.app-content-canvas {
  margin-left: 260px;
  flex: 1;
  padding: 40px 48px;
  min-height: 100vh;
  width: calc(100% - 260px);
}

.mobile-top-bar {
  display: none; /* Desktop hidden */
}

/* Sidebar Branding */
.sidebar-brand {
  margin-bottom: 32px;
}
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 850;
  letter-spacing: -0.03em;
}
.logo-accent {
  color: var(--color-primary);
}

/* Sidebar Nav links */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}
.nav-link:hover {
  color: var(--text-primary);
  background-color: var(--surface-hover);
}
.nav-link.active {
  color: var(--color-primary);
  background-color: rgba(37, 99, 235, 0.08);
  font-weight: 600;
}

/* Sidebar Footer & Stats */
.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-user-pill {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.user-pill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.user-name-tag {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.user-streak-tag {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-warning);
}
.user-level-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.footer-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.theme-toggle-btn {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast);
}
.theme-toggle-btn:hover {
  background-color: var(--surface-hover);
}
.version-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* SPA Pages Container */
.view-panel {
  display: none;
  animation: pageFadeIn var(--transition-normal) forwards;
}
.view-panel.active {
  display: block;
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------
   3. Typography & UI Components (Cards, Buttons)
   ---------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover {
  border-color: var(--border-color-hover);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
}
.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color-hover);
  color: var(--text-primary);
}
.btn-outline:hover {
  background-color: var(--surface-hover);
}
.btn-danger {
  background-color: var(--color-danger);
  color: #ffffff;
}
.btn-danger:hover {
  opacity: 0.9;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}
.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}
.btn-block {
  width: 100%;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}
.badge-accent {
  background: rgba(37, 99, 235, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

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

/* Form inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-group input, .form-group select, .form-group textarea {
  padding: 10px 14px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--color-primary);
}
.input-inline-wrap {
  display: flex;
  gap: 8px;
}
.input-inline-wrap input {
  flex: 1;
}

/* ----------------------------------------------------
   4. Home Page View
   ---------------------------------------------------- */
.home-layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.home-hero-card {
  padding: 40px !important;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, rgba(96, 165, 250, 0.03) 100%);
}
.hero-pill {
  display: inline-block;
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}
.home-hero-card h1 {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.home-hero-card p {
  font-size: 1.05rem;
  max-width: 600px;
  margin-bottom: 24px;
}

/* Universal study search wrapper */
.universal-search-wrap {
  display: flex;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px;
  max-width: 650px;
  gap: 8px;
  box-shadow: var(--box-shadow);
}
.universal-search-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0 12px;
  outline: none;
}

.popular-topics-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.popular-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.topic-chip {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.topic-chip:hover {
  background-color: var(--surface-hover);
  border-color: var(--text-muted);
}

/* Quick Hub Cards */
.quick-actions-grid-section h3 {
  margin-bottom: 16px;
}
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
}
.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
}
.action-icon {
  font-size: 2rem;
}

/* ----------------------------------------------------
   5. AI Agent Architecture Visualizer
   ---------------------------------------------------- */
.viz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.viz-desc {
  margin-top: 4px;
  margin-bottom: 24px;
}

.agent-workflow-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.workflow-endpoint {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.user-input-node {
  background: rgba(96, 165, 250, 0.08);
}
.user-output-node {
  background: rgba(16, 185, 129, 0.08);
}
.node-icon {
  font-size: 1.4rem;
}
.node-details {
  display: flex;
  flex-direction: column;
}
.node-details strong {
  font-size: 0.95rem;
}
.node-details span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.workflow-direction-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
}

.agent-coordinator-card {
  background: var(--bg-color);
  border: 1px solid var(--color-primary);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 700;
}
.agent-coordinator-card small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.subagents-viz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  width: 100%;
}
.agent-viz-card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  align-items: center;
}
.agent-viz-icon {
  font-size: 1.5rem;
}
.agent-viz-card h5 {
  font-size: 0.95rem;
}
.agent-viz-card p {
  font-size: 0.78rem;
  line-height: 1.4;
  flex: 1;
}
.agent-io {
  display: inline-block;
  background: rgba(37, 99, 235, 0.08);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  margin-top: 4px;
}

/* ----------------------------------------------------
   6. Learn / Study Search Outputs
   ---------------------------------------------------- */
.learn-placeholder-layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.syllabus-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.syllabus-chip {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.syllabus-chip:hover {
  background-color: var(--surface-hover);
  border-color: var(--color-primary);
}

.study-guide-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.study-guide-sub-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.guide-search-wrapper {
  display: flex;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px;
  flex: 1;
}
.guide-search-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0 10px;
}

.guide-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.guide-title-row {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}
.guide-topic-pill {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
}

.guide-section {
  position: relative;
}
.section-badge {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.concepts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.concept-subcard {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}
.concept-subcard h5 {
  font-size: 0.95rem;
}
.concept-subcard p {
  font-size: 0.85rem;
}

.definitions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.definition-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.def-term {
  color: var(--color-primary);
  min-width: 120px;
}
.def-desc {
  font-size: 0.9rem;
}

.formulas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.formula-card {
  background: var(--bg-color) !important;
}
.formula-equation {
  display: block;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  padding: 8px;
  font-family: monospace;
  text-align: center;
  border-radius: var(--radius-sm);
  color: var(--color-secondary);
  font-size: 1.05rem;
  margin: 6px 0;
}
.formula-desc {
  font-size: 0.78rem;
}

.alert-notes-wrapper {
  background: rgba(37, 99, 235, 0.04);
  border: 1px solid rgba(37, 99, 235, 0.15);
  padding: 20px;
  border-radius: var(--radius-md);
}
.exam-notes-text-box p {
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.exam-notes-text-box p:last-child {
  margin-bottom: 0;
}

.mistakes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.mistake-card {
  background: rgba(239, 68, 68, 0.04);
  border: 1px solid rgba(239, 68, 68, 0.1);
  padding: 16px;
  border-radius: var(--radius-md);
}
.mistake-card h5 {
  color: var(--color-danger);
}
.mistake-card p {
  font-size: 0.85rem;
}

.revision-list-card {
  background: var(--bg-color) !important;
}
.revision-bullet-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.revision-bullet-list li {
  font-size: 0.9rem;
  font-weight: 500;
}

.practice-questions-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.practice-q-card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: var(--radius-md);
}
.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.q-header strong {
  font-size: 0.95rem;
}
.q-answer-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
}

/* Videos YouTube Cards Layout */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.video-card {
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-color) !important;
}
.video-thumbnail-wrapper {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  position: relative;
}
.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-duration-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}
.video-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.video-channel-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}
.video-title {
  font-size: 0.88rem;
  line-height: 1.4;
  flex: 1;
}

/* ----------------------------------------------------
   7. Notes Generator View
   ---------------------------------------------------- */
.notes-layout-wrapper, .pdf-layout-wrapper {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.notes-grid, .pdf-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 32px;
  align-items: start;
}

.notes-mode-selectors {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.radio-card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  align-items: flex-start;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.radio-card:hover {
  border-color: var(--border-color-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06);
}
.radio-card input {
  margin-top: 4px;
  accent-color: var(--color-primary);
}
.radio-label-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.radio-label-content strong {
  font-size: 0.88rem;
}
.radio-label-content span {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.radio-card:has(input:checked) {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.05);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

/* AI Mode Badge */
.notes-mode-badge-wrap {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}
.ai-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  user-select: none;
}
.ai-mode-badge.ai-mode-claude {
  background: rgba(16, 185, 129, 0.08);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.25);
}
.ai-mode-badge.ai-mode-local {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.ai-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ai-mode-claude .ai-badge-dot {
  background: var(--color-success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: pulseDot 2s ease-in-out infinite;
}
.ai-mode-local .ai-badge-dot {
  background: var(--text-muted);
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}

.notes-workspace, .pdf-workspace, .pdf-summary-workspace {
  position: relative;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.note-editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.note-editor-container textarea {
  width: 100%;
  height: 380px;
  background: var(--bg-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  outline: none;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.92rem;
  resize: vertical;
  line-height: 1.7;
  transition: border-color var(--transition-fast);
}
.note-editor-container textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Workspace overlay loaders */
.note-loader-overlay, .pdf-loader-overlay, .pdf-progress-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  border-radius: var(--radius-lg);
  z-index: 100;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.loader-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ----------------------------------------------------
   8. PDF Summarizer View
   ---------------------------------------------------- */
.pdf-dropzone {
  border: 2px dashed var(--border-color-hover);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-color);
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.pdf-dropzone:hover, .pdf-dropzone.dragover {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.03);
}
.dropzone-icon {
  font-size: 2.2rem;
}

.file-details-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  position: relative;
}
.file-icon {
  font-size: 1.5rem;
}
.file-info-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.file-info-text strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-info-text span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.progress-info-text {
  display: flex;
  justify-content: space-between;
  width: 70%;
  font-weight: 600;
  font-size: 0.9rem;
}

.pdf-summary-results-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.placeholder-summary-text {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
}
.summary-results-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.result-card h4 {
  margin-bottom: 6px;
}

/* ----------------------------------------------------
   9. Quiz Arena View
   ---------------------------------------------------- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
}
.category-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}
.cat-icon {
  font-size: 2.2rem;
}

/* ----------------------------------------------------
   10. Progress Dashboard & Settings
   ---------------------------------------------------- */
.dashboard-main-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 32px;
  align-items: start;
}
.dashboard-left-col {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.chart-canvas {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 190px;
  padding: 10px 20px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}
.chart-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.chart-bar-value {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-primary);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.chart-bar-wrap:hover .chart-bar-value {
  opacity: 1;
}
.chart-bar-col {
  width: 24px;
  background-color: var(--surface-color);
  border-radius: 4px 4px 0 0;
  transition: height 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.2), background-color var(--transition-fast);
}
.chart-bar-col.active {
  background: var(--primary-gradient);
}
.chart-bar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Settings & profile cabinet styles */
.settings-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 32px;
  margin-top: 32px;
}
.settings-left-col {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.backup-actions {
  display: flex;
  gap: 12px;
}
.backup-actions button {
  flex: 1;
}

.badges-cabinet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
}
.badge-cabinet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 8px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.badge-cabinet-item.locked {
  opacity: 0.25;
  filter: grayscale(1);
}
.badge-cabinet-icon {
  font-size: 2.2rem;
  margin-bottom: 6px;
}
.badge-cabinet-name {
  font-size: 0.78rem;
  font-weight: 700;
}
.badge-cabinet-desc {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ----------------------------------------------------
   11. Overlays, confetti, alerts, and notifications
   ---------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast-item {
  min-width: 260px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--box-shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.25);
}
.toast-item.show {
  transform: translateY(0);
  opacity: 1;
}
.toast-success { border-left: 4px solid var(--color-success); }
.toast-warning { border-left: 4px solid var(--color-danger); }
.toast-xp { border-left: 4px solid var(--color-secondary); }
.toast-msg { font-size: 0.88rem; font-weight: 600; }

.celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}
.celebration-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.celebration-card {
  width: 90%;
  max-width: 420px;
  background: var(--surface-color);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}
.celebration-overlay.active .celebration-card {
  transform: scale(1);
}

.celebration-icon-wrap {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}
.celebration-title {
  color: var(--color-warning);
}
.celebration-subtitle {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: -8px;
}
.celebration-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.celebration-footer {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.animate-bounce-short {
  animation: bounceShort 2s ease infinite;
}
@keyframes bounceShort {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.confetti-holder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.confetti-particle {
  position: absolute;
  width: 6px;
  height: 10px;
  opacity: 0.85;
  border-radius: 1px;
  animation: fallConfetti linear forwards;
}
@keyframes fallConfetti {
  to {
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot));
    opacity: 0;
  }
}

/* ----------------------------------------------------
   12. Responsive Media Queries (Mobile layout overrides)
   ---------------------------------------------------- */
@media (max-width: 1024px) {
  /* Hide sidebar on desktop, enable sliding drawer menu */
  .app-sidebar {
    transform: translateX(-260px);
    z-index: 1001;
    position: fixed;
    top: 0;
    left: 0;
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  
  .app-content-canvas {
    margin-left: 0;
    width: 100%;
    padding: 100px 24px 40px;
  }

  .mobile-top-bar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--card-shadow);
  }

  .hamburger-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 22px;
  }
  .hamburger-btn .bar {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
  }
  .mobile-logo {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.15rem;
  }

  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  .notes-grid, .pdf-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-main-row {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .home-hero-card {
    padding: 24px !important;
  }
  .home-hero-card h1 {
    font-size: 1.8rem;
  }
  .chart-canvas {
    overflow-x: auto;
    gap: 8px;
  }
}

/* ==========================================================================
   Chat & Agentic Copilot View Styles
   ========================================================================== */
.nav-link-agent {
  position: relative;
  background: rgba(59, 130, 246, 0.08);
}
.nav-badge-live {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: #10B981;
  color: #FFFFFF;
  letter-spacing: 0.5px;
  animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(0.95); }
}

.action-card-highlight {
  border: 1px solid var(--color-primary) !important;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(96, 165, 250, 0.05)) !important;
}

.chat-layout-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 50px);
  max-width: 1050px;
  margin: 0 auto;
  gap: 14px;
}

.chat-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-agent-avatar {
  font-size: 2rem;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.chat-agent-info h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.chat-agent-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-model-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-primary);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Quick Prompt Chips */
.chat-quick-prompts {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.prompts-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.prompt-chip {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.prompt-chip:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

/* Messages Box */
.chat-messages-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.chat-empty-state {
  margin: auto;
  text-align: center;
  max-width: 480px;
  padding: 30px 20px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.chat-empty-state h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.chat-empty-state p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Message Rows */
.chat-message-row {
  display: flex;
  gap: 12px;
  max-width: 90%;
}

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

.message-row-assistant {
  align-self: flex-start;
}

.chat-avatar {
  font-size: 1.5rem;
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  border-radius: 50%;
  border: 1px solid var(--border-color);
}

.chat-bubble-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-bubble-author {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.message-row-user .chat-bubble-author {
  text-align: right;
}

.chat-bubble-text {
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.message-row-user .chat-bubble-text {
  background: var(--color-primary);
  color: #FFFFFF;
  border-bottom-right-radius: 2px;
}

.message-row-assistant .chat-bubble-text {
  background: var(--surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 2px;
}

.chat-bubble-text h2, .chat-bubble-text h3, .chat-bubble-text h4 {
  margin: 10px 0 6px;
  font-weight: 700;
}

.chat-list {
  margin: 8px 0 8px 20px;
}

.inline-code {
  background: rgba(0,0,0,0.25);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}

/* Agent Reasoning & Step Trace */
.agent-trace-container {
  background: rgba(59, 130, 246, 0.06);
  border: 1px dashed rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-trace-header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-primary);
}

.agent-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.step-thought { color: var(--text-secondary); }
.step-action { color: #60A5FA; font-weight: 600; }
.step-observation { color: var(--color-success); }

/* Tool Widgets Container */
.chat-tool-widgets-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.widget-card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.widget-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* YouTube Video Cards Grid */
.youtube-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.yt-video-card {
  display: flex;
  flex-direction: column;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-decoration: none;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.yt-video-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
}

.yt-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #000;
}

.yt-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(239, 68, 68, 0.9);
  color: #FFF;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.yt-details {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.yt-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.yt-channel {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Web Search Results Widget */
.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-result-item {
  background: var(--surface-color);
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.search-result-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
  display: inline-block;
  margin-bottom: 4px;
}

.search-result-snippet {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Interactive Chat Quiz */
.chat-quiz-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-quiz-item {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.chat-quiz-question {
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.chat-quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.chat-quiz-opt-btn {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-quiz-opt-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--color-primary);
}

.chat-quiz-opt-btn.opt-correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10B981 !important;
  color: #10B981 !important;
  font-weight: 600;
}

.chat-quiz-opt-btn.opt-wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #EF4444 !important;
  color: #EF4444 !important;
}

.chat-quiz-feedback {
  margin-top: 8px;
  padding: 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.feedback-correct {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
}

.feedback-wrong {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

/* Roadmap Widget */
.roadmap-stages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roadmap-stage-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-color);
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.stage-day-badge {
  background: var(--color-primary);
  color: #FFF;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.stage-info strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.stage-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Status Tray */
.chat-status-tray {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--color-primary);
  background: rgba(59, 130, 246, 0.08);
  border-radius: var(--radius-sm);
}

.status-indicator-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Input Container */
.chat-input-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.chat-input-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.95rem;
  resize: none;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

.chat-textarea:focus {
  border-color: var(--color-primary);
}

.btn-chat-send {
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-input-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}


/* ==========================================================================
   13. Enhanced Mobile & Cross-Device Responsiveness
   ========================================================================== */

/* --- Tablet (769px - 1024px) --- */
@media (max-width: 1024px) and (min-width: 769px) {
  .quick-actions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .subagents-viz-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Mobile (max 768px) --- */
@media (max-width: 768px) {
  /* Content canvas: full width, top space for topbar, bottom space for bottom nav */
  .app-content-canvas {
    margin-left: 0;
    width: 100%;
    padding: 80px 16px 80px;
  }

  /* Home hero */
  .home-hero-card {
    padding: 20px !important;
  }
  .home-hero-card h1 {
    font-size: 1.7rem;
    line-height: 1.2;
  }
  .home-hero-card p {
    font-size: 0.9rem;
  }

  /* Search bar stacks vertically */
  .universal-search-wrap {
    flex-direction: column;
    max-width: 100%;
    gap: 8px;
    padding: 8px;
  }
  .universal-search-wrap input {
    width: 100%;
    padding: 10px 14px;
  }
  .universal-search-wrap .btn {
    width: 100%;
    justify-content: center;
  }

  /* Quick actions 2-column grid */
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .action-card {
    padding: 14px 10px;
    gap: 6px;
  }
  .action-icon { font-size: 1.6rem; }
  .action-card h4 { font-size: 0.85rem; }
  .action-card p { font-size: 0.75rem; }

  /* Popular topics row scrollable */
  .popular-topics-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .popular-topics-row::-webkit-scrollbar { display: none; }

  /* Force single column layouts */
  .notes-grid,
  .pdf-grid,
  .dashboard-main-row,
  .settings-grid,
  .subagents-viz-grid,
  .youtube-cards-grid {
    grid-template-columns: 1fr !important;
  }

  /* Cards tighter padding */
  .card { padding: 16px; }

  /* Chat layout */
  .chat-layout-wrapper {
    height: calc(100dvh - 80px);
    gap: 8px;
  }
  .chat-header-card {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .chat-agent-info h2 { font-size: 1rem; }
  .chat-messages-box {
    padding: 12px;
    gap: 12px;
  }
  .chat-message-row { max-width: 100%; }
  .chat-bubble-text {
    padding: 10px 12px;
    font-size: 0.88rem;
  }
  .chat-quick-prompts { gap: 6px; }
  .prompt-chip {
    font-size: 0.75rem;
    padding: 5px 10px;
  }

  /* Headings */
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }

  /* Chart overflow */
  .chart-canvas { overflow-x: auto; }

  /* Toast above bottom nav */
  .toast-container {
    bottom: 76px !important;
    right: 12px !important;
  }
}

/* --- Small phones (max 480px) --- */
@media (max-width: 480px) {
  .app-content-canvas {
    padding: 76px 12px 76px;
  }
  .home-hero-card { padding: 14px !important; }
  .home-hero-card h1 { font-size: 1.45rem; }

  /* Action cards: 2 col, hide description text */
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .action-card p { display: none; }

  /* Prevent iOS zoom on input focus */
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* --- Bottom Mobile Navigation Bar --- */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 1024px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  }

  .mobile-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    padding: 6px 2px;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: color var(--transition-fast);
  }
  .mobile-bottom-nav-item .bnav-icon {
    font-size: 1.3rem;
    line-height: 1;
  }
  .mobile-bottom-nav-item.active,
  .mobile-bottom-nav-item:hover {
    color: var(--color-primary);
  }
}

/* --- Touch tap improvements --- */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .topic-chip, .prompt-chip, .syllabus-chip { padding: 8px 14px; }
  .chat-quiz-opt-btn { padding: 12px 16px; }
}

/* --- PWA safe area for notched phones --- */
@supports (padding-top: env(safe-area-inset-top)) {
  @media (max-width: 1024px) {
    .mobile-top-bar {
      padding-top: env(safe-area-inset-top);
      height: calc(70px + env(safe-area-inset-top));
    }
    .app-content-canvas {
      padding-top: calc(80px + env(safe-area-inset-top));
    }
  }
}

/* --- Wide desktop (1440px+) --- */
@media (min-width: 1440px) {
  .app-content-canvas {
    padding: 40px 64px;
  }
  .chat-layout-wrapper {
    max-width: 1100px;
  }
}

/* --- Landscape mobile fix --- */
@media (max-width: 900px) and (orientation: landscape) {
  .chat-layout-wrapper {
    height: calc(100dvh - 56px);
  }
  .mobile-top-bar { height: 56px; }
  .app-content-canvas { padding-top: 64px; }
}
