/* style.css - Premium Design System & Styles for Learn Anything AI */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
  /* Colors */
  --bg-dark: #070510;
  --bg-darker: #04030a;
  --card-bg: rgba(18, 14, 36, 0.4);
  --card-border: rgba(255, 255, 255, 0.07);
  --card-border-hover: rgba(139, 92, 246, 0.4);
  
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.3);
  --secondary: #06b6d4;
  --secondary-glow: rgba(6, 182, 212, 0.3);
  --accent-glow: #a78bfa;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #4b5563;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  
  --sidebar-width: 280px;
  --header-height: 70px;
  
  /* Fonts */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Fira Code', monospace;
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Glowing Background Blobs */
.bg-glow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  animation: orb-float 20s infinite alternate;
}

.orb-1 {
  background: var(--primary);
  width: 40vw;
  height: 40vw;
  top: -10vw;
  left: -10vw;
  animation-duration: 25s;
}

.orb-2 {
  background: var(--secondary);
  width: 35vw;
  height: 35vw;
  bottom: -5vw;
  right: -5vw;
  animation-duration: 18s;
  animation-delay: 2s;
}

.orb-3 {
  background: #ec4899;
  width: 25vw;
  height: 25vw;
  top: 30vh;
  left: 60vw;
  animation-duration: 22s;
  animation-delay: 5s;
}

@keyframes orb-float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5vw, 5vh) scale(1.1); }
  100% { transform: translate(-3vw, -2vh) scale(0.9); }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

p {
  line-height: 1.6;
  color: var(--text-muted);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--accent-glow);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

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

/* App Wrapper Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(6, 4, 15, 0.85);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  z-index: 100;
  transition: var(--transition-smooth);
}

.brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--card-border);
}

.brand-logo {
  font-size: 28px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: logo-pulse 4s infinite alternate;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(to right, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  list-style: none;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.nav-link:hover, .nav-link.active {
  color: #fff;
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.2);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.05));
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.1);
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* Sidebar Footer / API Indicator */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--card-border);
  background: rgba(0,0,0,0.15);
}

.api-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.api-status:hover {
  background: rgba(255,255,255,0.05);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.status-dot.active {
  background-color: var(--success);
  color: var(--success);
}

.status-dot.simulated {
  background-color: var(--warning);
  color: var(--warning);
}

.status-text {
  font-weight: 600;
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.top-header {
  height: var(--header-height);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-bottom: 1px solid var(--card-border);
  background: rgba(7, 5, 16, 0.3);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 90;
}

.xp-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  color: var(--warning);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.1);
  animation: float 3s infinite alternate;
}

/* Content Views */
.view-panel {
  flex-grow: 1;
  padding: 40px;
  display: none;
  animation: fade-in 0.4s ease-out;
}

.view-panel.active {
  display: block;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glassmorphic Cards & UI Elements */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: var(--card-border-hover);
  box-shadow: 0 15px 35px rgba(139, 92, 246, 0.1);
}

/* Interactive Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
  outline: none;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
  background: linear-gradient(135deg, #9b72f8, #8b5cf6);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--secondary), #0891b2);
  color: #fff;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.5);
  background: linear-gradient(135deg, #22d3ee, #06b6d4);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 16px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
  background: rgba(0, 0, 0, 0.5);
}

.form-select option {
  background-color: var(--bg-dark);
  color: #fff;
}

/* ==========================================================================
   VIEW 1: Dashboard / Home
   ========================================================================== */
.hero-section {
  text-align: center;
  max-width: 800px;
  margin: 40px auto 60px auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: var(--accent-glow);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}

.hero-title {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff 30%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-title span {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 18px;
  margin-bottom: 40px;
}

/* Search Box Container */
.search-container {
  max-width: 650px;
  margin: 0 auto;
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  padding: 8px 8px 8px 24px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(139, 92, 246, 0.05);
  transition: var(--transition-smooth);
}

.search-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(139, 92, 246, 0.2);
}

.search-icon {
  font-size: 20px;
  color: var(--text-muted);
  margin-right: 12px;
}

.search-field {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  font-family: var(--font-body);
  outline: none;
}

.search-field::placeholder {
  color: var(--text-dark);
}

.search-btn {
  border-radius: 99px;
}

/* Dashboard Sections */
.section-title {
  font-size: 22px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 60px;
}

.topic-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 200px;
}

.topic-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.topic-icon {
  font-size: 32px;
  background: rgba(255,255,255,0.05);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.05);
  transition: var(--transition-smooth);
}

.topic-card:hover .topic-icon {
  background: var(--primary-glow);
  border-color: rgba(139,92,246,0.3);
  transform: scale(1.05);
}

.topic-cat {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--secondary);
}

.topic-info {
  margin-top: 16px;
}

.topic-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.topic-desc {
  font-size: 13px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Custom Config Bar */
.config-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
  justify-content: center;
}

.config-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.config-item select {
  background: transparent;
  border: none;
  color: #fff;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

/* ==========================================================================
   VIEW 2: Learning Room
   ========================================================================== */
.learning-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 30px;
  align-items: stretch;
  height: calc(100vh - var(--header-height) - 80px);
}

.left-panel, .right-panel-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Explanations Display */
.explanation-card {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.back-dashboard {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.back-dashboard:hover {
  color: #fff;
}

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

.depth-tabs {
  display: flex;
  background: rgba(0,0,0,0.25);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

/* Explanation Reading Body */
.explanation-scroll {
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 10px;
  font-size: 15px;
  line-height: 1.7;
}

.explanation-scroll h1, .explanation-scroll h2, .explanation-scroll h3 {
  margin: 20px 0 12px 0;
  color: #fff;
}

.explanation-scroll h4 {
  margin: 16px 0 8px 0;
  color: var(--accent-glow);
}

.explanation-scroll ul, .explanation-scroll ol {
  margin-left: 20px;
  margin-bottom: 16px;
}

.explanation-scroll li {
  margin-bottom: 8px;
}

.explanation-scroll pre {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--card-border);
  padding: 16px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 14px;
}

.explanation-scroll code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--secondary);
}

.explanation-scroll blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-muted);
  font-style: italic;
}

.explanation-scroll p {
  margin-bottom: 16px;
}

/* Mind Map Card */
.mindmap-container {
  margin-top: 20px;
  height: 280px;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--card-border);
}

.mindmap-canvas {
  width: 100%;
  height: 100%;
  cursor: grab;
}

.mindmap-canvas:active {
  cursor: grabbing;
}

.mindmap-tooltip {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(7, 5, 16, 0.9);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 12px;
  color: #fff;
  pointer-events: none;
  max-width: 85%;
  text-align: center;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
  transition: opacity 0.3s ease;
  opacity: 0;
}

/* Chat & Voice Section (Right Panel) */
.tutor-card {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Interactive AI Avatar Sphere & Visualizer */
.avatar-visualizer-container {
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 15px;
}

.avatar-canvas {
  width: 120px;
  height: 120px;
}

.tutor-status-lbl {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Speech Feed / Messages Log */
.chat-scroll {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 10px 5px;
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

.chat-bubble.tutor {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-bubble.tutor::before {
  content: "Aura";
  position: absolute;
  top: -18px;
  left: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-bubble.student {
  background: linear-gradient(135deg, var(--primary-glow), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(139, 92, 246, 0.2);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  color: #fff;
}

.chat-bubble.student::before {
  content: "You";
  position: absolute;
  top: -18px;
  right: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.speech-btn-icon {
  cursor: pointer;
  display: inline-block;
  margin-left: 8px;
  font-size: 14px;
  opacity: 0.6;
  transition: var(--transition-fast);
}

.speech-btn-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Chat Input Bar */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--card-border);
  padding-top: 16px;
  margin-top: 10px;
}

.chat-text-input {
  flex-grow: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px 18px;
  color: #fff;
  outline: none;
  font-size: 14px;
  transition: var(--transition-smooth);
}

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

/* Mic/Voice Interaction Controls */
.mic-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-size: 18px;
}

.mic-btn:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.mic-btn.recording {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
  animation: mic-pulse 1.5s infinite alternate;
}

@keyframes mic-pulse {
  0% { transform: scale(1); box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); }
  100% { transform: scale(1.08); box-shadow: 0 0 25px rgba(239, 68, 68, 0.8); }
}

.sound-toggle-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-size: 18px;
}

.sound-toggle-btn.muted {
  color: var(--text-dark);
  border-color: var(--card-border);
}

.sound-toggle-btn.active {
  color: var(--secondary);
  border-color: var(--secondary);
  background: rgba(6, 182, 212, 0.1);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* ==========================================================================
   VIEW 3: Quiz Console
   ========================================================================== */
.quiz-wrapper {
  max-width: 750px;
  margin: 20px auto;
  position: relative;
}

.quiz-progress-bar-container {
  height: 6px;
  width: 100%;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  margin-bottom: 24px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.quiz-q-num {
  font-weight: 600;
  color: var(--secondary);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.quiz-timer {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border);
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
}

.quiz-question-title {
  font-size: 20px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-option {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
}

.quiz-option:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(4px);
}

.quiz-opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.quiz-option:hover .quiz-opt-letter {
  background: var(--primary-glow);
  color: #fff;
  border-color: var(--primary);
}

/* Quiz Option States */
.quiz-option.correct {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--success);
  color: #fff;
}

.quiz-option.correct .quiz-opt-letter {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

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

.quiz-option.wrong .quiz-opt-letter {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

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

/* Quiz Feedback Box */
.quiz-feedback-box {
  margin-top: 24px;
  padding: 20px;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  border-left: 4px solid var(--secondary);
  animation: slide-up 0.3s ease-out;
  display: none;
}

.quiz-feedback-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-feedback-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.quiz-action-bar {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Quiz Result / Completion Screen */
.quiz-result-card {
  text-align: center;
  padding: 40px;
}

.result-badge-anim {
  font-size: 72px;
  margin-bottom: 20px;
  animation: float 4s infinite alternate;
}

.result-score {
  font-size: 40px;
  font-family: var(--font-display);
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-msg {
  font-size: 16px;
  max-width: 500px;
  margin: 0 auto 30px auto;
}

.stats-summary {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 40px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-val {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   VIEW 4: Library & History
   ========================================================================== */
.library-stats-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.lib-stat-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
}

.lib-stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.history-item:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--card-border-hover);
  transform: translateX(4px);
}

.history-main-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.history-icon {
  font-size: 24px;
}

.history-title-txt {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.history-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

.history-score {
  font-weight: 700;
  font-size: 15px;
  color: var(--secondary);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  padding: 6px 12px;
  border-radius: 8px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 40px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ==========================================================================
   VIEW 5: Badges / Achievements
   ========================================================================== */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
}

.badge-card {
  text-align: center;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0.4;
  filter: grayscale(1);
  transition: var(--transition-smooth);
}

.badge-card.unlocked {
  opacity: 1;
  filter: grayscale(0);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(6, 182, 212, 0.05));
  border-color: rgba(139, 92, 246, 0.2);
}

.badge-card.unlocked:hover {
  transform: translateY(-5px);
  border-color: var(--card-border-hover);
  box-shadow: 0 10px 25px rgba(139, 92, 246, 0.15);
}

.badge-icon-box {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 16px;
  transition: var(--transition-smooth);
}

.badge-card.unlocked .badge-icon-box {
  background: var(--primary-glow);
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.badge-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.badge-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ==========================================================================
   VIEW 6: Settings Modal / View
   ========================================================================== */
.settings-layout {
  max-width: 600px;
  margin: 0 auto;
}

.settings-card {
  padding: 30px;
}

.settings-subtitle {
  font-size: 14px;
  margin-bottom: 24px;
}

/* Key Helper Note */
.key-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  background: rgba(255,255,255,0.01);
  padding: 10px;
  border-radius: 8px;
  border-left: 2px solid var(--secondary);
}

/* ==========================================================================
   Utility Animations
   ========================================================================== */
@keyframes float {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

@keyframes logo-pulse {
  0% { filter: drop-shadow(0 0 2px rgba(139, 92, 246, 0.4)); }
  100% { filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.7)); }
}

/* Responsive Rules */
@media (max-width: 1024px) {
  .learning-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .right-panel-chat {
    height: 500px;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
  }
  .brand {
    justify-content: space-between;
    padding: 16px 24px;
  }
  .nav-menu {
    flex-direction: row;
    padding: 8px 16px;
    overflow-x: auto;
    white-space: nowrap;
  }
  .nav-link {
    padding: 8px 14px;
    font-size: 13px;
  }
  .sidebar-footer {
    display: none;
  }
  .main-content {
    margin-left: 0;
  }
  .top-header {
    padding: 0 20px;
  }
  .view-panel {
    padding: 20px;
  }
  .hero-title {
    font-size: 32px;
  }
  .library-stats-cards {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════ */
/* LIMITS & SUBSCRIPTION STATUS CHIP          */
/* ══════════════════════════════════════════ */
.limits-badge {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  margin: 10px 16px 20px 16px;
  border: 1px solid var(--card-border);
  transition: var(--transition-smooth);
}

.limits-badge.trial {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--accent-glow);
}

.limits-badge.premium {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.1) 100%);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.1);
}

/* ══════════════════════════════════════════ */
/* PAYWALL MODAL STYLES                       */
/* ══════════════════════════════════════════ */
.paywall-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(4, 3, 10, 0.85);
  backdrop-filter: blur(10px);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.paywall-modal.active {
  display: flex;
}

.paywall-card {
  width: 100%;
  max-width: 480px;
  padding: 40px 30px;
  border-radius: 28px;
  text-align: center;
  position: relative;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.2);
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.paywall-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.paywall-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.paywall-icon {
  font-size: 50px;
  margin-bottom: 16px;
  animation: float 4s ease-in-out infinite;
}

.paywall-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-main);
}

.paywall-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.paywall-pricing-card {
  background: linear-gradient(145deg, rgba(20, 16, 42, 0.8) 0%, rgba(10, 8, 22, 0.9) 100%);
  border: 2px solid var(--primary);
  border-radius: 20px;
  padding: 28px 24px;
  position: relative;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.15);
}

.paywall-plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 1px;
}

.paywall-price {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: baseline;
}

.paywall-currency {
  font-size: 24px;
  font-weight: 700;
  color: var(--secondary);
  margin-right: 2px;
}

.paywall-amount {
  font-size: 48px;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--text-main);
}

.paywall-period {
  font-size: 15px;
  color: var(--text-muted);
  margin-left: 4px;
}

.paywall-features {
  list-style: none;
  text-align: left;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paywall-features li {
  font-size: 13.5px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.paywall-buy-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.paywall-secure {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
}
