/*
 * LinAlg Course
 * Boxy, structured aesthetic - dark purple theme
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-primary: #09090b;
  --bg-secondary: #0c0c0f;
  --bg-tertiary: #111114;
  --bg-card: #0e0e11;

  --purple-500: #a855f7;
  --purple-400: #c084fc;
  --purple-600: #9333ea;
  --purple-900: #1a0a2e;

  --accent: #fafafa;
  --accent-hover: #d4d4d8;
  --accent-dark: #a1a1aa;

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;

  --border: #fafafa;
  --border-muted: #27272a;

  --success: #22c55e;
  --error: #ef4444;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

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

::selection {
  background: var(--text-secondary);
  color: var(--bg-primary);
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: 2.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }

p { color: var(--text-secondary); }

.mono {
  font-family: 'JetBrains Mono', monospace;
}

.text-gradient {
  color: var(--text-secondary);
}

.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ========================================
   Layout
   ======================================== */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: 5rem 0;
  border-bottom: 3px solid var(--border-muted);
}

/* ========================================
   Navbar
   ======================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-primary);
  border-bottom: 3px solid var(--text-primary);
  padding: 1rem 0;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-logo svg {
  width: 20px;
  height: 20px;
  color: var(--text-primary);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.35rem 0.75rem;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.nav-links a:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ========================================
   Buttons - Square, minimal, border-focused
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 2px solid;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: transparent;
  color: var(--text-primary);
}

.btn-secondary {
  background: transparent;
  border-color: var(--text-primary);
  color: var(--text-primary);
}

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

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  text-transform: lowercase;
  letter-spacing: 0;
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-lg {
  padding: 0.85rem 2rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.7rem;
}

/* ========================================
   Cards - Boxy with thick borders
   ======================================== */
.card {
  background: var(--bg-card);
  border: 2px solid var(--border-muted);
  padding: 1.5rem;
}

.card:hover {
  border-color: var(--text-primary);
}

/* ========================================
   Hero
   ======================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 80px;
  border-bottom: 3px solid var(--text-primary);
}

.hero-content {
  max-width: 580px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-muted);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
}

.hero h1 {
  margin-bottom: 1.25rem;
}

.hero-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-visual {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 35%;
  aspect-ratio: 1;
  opacity: 0.4;
}

/* ========================================
   Module Cards
   ======================================== */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.module-card {
  padding: 1.5rem;
  transition: all 0.2s;
  position: relative;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 0;
  background: var(--accent);
  transition: height 0.2s;
}

.module-card:hover::before {
  height: 100%;
}

.module-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

.module-card h3 {
  margin-bottom: 0.5rem;
}

.module-card p {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.module-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  padding-top: 1rem;
  border-top: 1px solid var(--border-muted);
}

/* ========================================
   Progress Bar
   ======================================== */
.progress-container {
  margin: 0.75rem 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.progress-label {
  color: var(--text-muted);
}

.progress-value {
  color: var(--accent);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.progress-bar {
  height: 3px;
  background: var(--border-muted);
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s;
}

/* ========================================
   Login
   ======================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-container {
  width: 100%;
  max-width: 360px;
}

.login-card {
  text-align: center;
  border: 3px solid var(--border);
}

.login-logo {
  margin-bottom: 2rem;
}

.login-card h2 {
  margin-bottom: 0.5rem;
}

.login-card .card-description {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-muted);
  border-radius: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

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

.form-error {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  display: none;
}

.form-error.show {
  display: block;
}

/* ========================================
   Dashboard
   ======================================== */
.dashboard {
  padding-top: 100px;
  min-height: 100vh;
  padding-bottom: 3rem;
}

.dashboard-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 3px solid var(--border-muted);
}

.dashboard-header h1 {
  margin-bottom: 0.25rem;
  font-size: 1.5rem;
}

.dashboard-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  text-align: center;
  padding: 1.25rem;
  border: 2px solid var(--border-muted);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========================================
   Module Page
   ======================================== */
.module-page {
  padding-top: 100px;
  min-height: 100vh;
  padding-bottom: 3rem;
}

.module-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 3px solid var(--border);
}

.module-header h1 {
  margin-bottom: 0.5rem;
  font-size: 1.75rem;
}

.module-content {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
}

.module-main {
  min-width: 0;
}

.module-sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.content-section {
  margin-bottom: 2.5rem;
}

.content-section h2 {
  margin-bottom: 1rem;
  font-size: 1.15rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

/* ========================================
   Animation Canvas
   ======================================== */
.animation-container {
  background: var(--bg-secondary);
  border: 2px solid var(--border-muted);
  padding: 1rem;
  margin: 1rem 0;
}

.animation-canvas {
  width: 100%;
  height: 260px;
  background: var(--bg-primary);
  border: 1px solid var(--border-muted);
  display: block;
}

.animation-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: center;
}

/* ========================================
   Quiz
   ======================================== */
.quiz-container {
  background: var(--bg-secondary);
  border: 2px solid var(--border-muted);
  padding: 1.5rem;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-muted);
}

.quiz-header h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quiz-progress {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.quiz-question {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.9rem;
}

.quiz-option:hover {
  border-color: var(--accent);
}

.quiz-option.selected {
  border-color: var(--text-primary);
  background: var(--bg-tertiary);
}

.quiz-option.correct {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.quiz-option.incorrect {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.quiz-option-marker {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.quiz-option.selected .quiz-option-marker {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: var(--bg-primary);
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-muted);
}

.quiz-result {
  text-align: center;
  padding: 2rem;
}

.quiz-score {
  font-size: 3rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
}

/* ========================================
   Sidebar Nav
   ======================================== */
.sidebar-nav-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.sidebar-nav-list {
  list-style: none;
}

.sidebar-nav-item {
  margin-bottom: 0.125rem;
}

.sidebar-nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.sidebar-nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-left-color: var(--accent);
}

.sidebar-nav-link.active {
  color: var(--text-primary);
  border-left-color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* ========================================
   Math Blocks
   ======================================== */
.math-block {
  background: var(--bg-secondary);
  border: 2px solid var(--border-muted);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  overflow-x: auto;
}

.math-inline {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-tertiary);
  padding: 0.1em 0.4em;
  font-size: 0.9em;
}

/* ========================================
   Alerts
   ======================================== */
.alert {
  padding: 1rem;
  margin: 1rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9rem;
  border: 2px solid;
  border-left-width: 4px;
}

.alert svg {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.alert-info {
  background: rgba(59, 130, 246, 0.05);
  border-color: #3b82f6;
  color: #60a5fa;
}

.alert-success {
  background: rgba(34, 197, 94, 0.05);
  border-color: #22c55e;
  color: #4ade80;
}

.alert-warning {
  background: rgba(234, 179, 8, 0.05);
  border-color: #eab308;
  color: #facc15;
}

.alert-error {
  background: rgba(239, 68, 68, 0.05);
  border-color: #ef4444;
  color: #f87171;
}

/* ========================================
   Footer
   ======================================== */
.footer {
  background: var(--bg-secondary);
  border-top: 3px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 4rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ========================================
   Utilities
   ======================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 1.5rem; }
.mt-3 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 1.5rem; }
.mb-3 { margin-bottom: 2rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.75rem; }
.gap-2 { gap: 1rem; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
  .module-content {
    grid-template-columns: 1fr;
  }
  .module-sidebar {
    position: static;
    order: -1;
  }
  .hero-visual {
    display: none;
  }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .modules-grid { grid-template-columns: 1fr; }
  .hero-buttons { flex-direction: column; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 2rem; }
}

@media (max-width: 480px) {
  .dashboard-stats { grid-template-columns: 1fr; }
  .quiz-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  .quiz-actions .btn { width: 100%; }
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-slide-up { animation: slideUp 0.3s ease; }
.animate-scale-in { animation: fadeIn 0.2s ease; }

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
