/* ===== Python Learning Portal - Light Theme ===== */

/* --- CSS Variables --- */
:root {
  --primary: #18181b;
  --primary-light: #27272a;
  --accent: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.2);
  --purple: #7c3aed;
  --purple-light: #a78bfa;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #eab308;
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.1);
  --bg: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --bg-surface: #f3f4f6;
  --text: #09090b;
  --text-muted: #71717a;
  --text-dim: #a1a1a5;
  --border: #e4e4e7;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);
  --transition: all 0.3s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', monospace;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: #1d4ed8; }

img { max-width: 100%; display: block; }

/* --- Typography --- */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }

.text-gradient {
  background: linear-gradient(135deg, var(--accent), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* --- Layout --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 5rem 0; }

/* --- Navbar --- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; }

.navbar-brand {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1.25rem; font-weight: 800; color: var(--text);
}
.navbar-brand .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 900; color: white;
}

.navbar-nav { display: flex; align-items: center; gap: 1.5rem; list-style: none; }
.navbar-nav a { color: var(--text-muted); font-weight: 500; font-size: 0.9rem; }
.navbar-nav a:hover, .navbar-nav a.active { color: var(--accent); }

.nav-auth { display: flex; align-items: center; gap: 0.75rem; }
.nav-user { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.95rem;
  border: none; cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white; box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 20px var(--accent-glow); color: white; }

.btn-secondary {
  background: var(--bg-surface); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
}

.btn-danger { background: var(--danger); color: white; }

.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-ghost:hover { background: rgba(37, 99, 235, 0.08); }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 2.5rem; font-size: 1.1rem; border-radius: var(--radius); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); }

/* --- Hero Section --- */
.hero {
  padding: 8rem 0 5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(37, 99, 235, 0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 50%, rgba(124, 58, 237, 0.04) 0%, transparent 50%);
  pointer-events: none;
}
.hero h1 { margin-bottom: 1.25rem; position: relative; }
.hero .subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 700px; margin: 0 auto 2.5rem;
  line-height: 1.7;
}
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; position: relative; }

/* --- Stats Bar --- */
.stats-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem; padding: 3rem 0;
}
.stat-item {
  text-align: center; padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.stat-number { font-size: 2rem; font-weight: 800; color: var(--accent); display: block; }
.stat-label { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }

/* --- Course Parts --- */
.parts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem; margin-top: 2rem;
}
.part-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.part-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: var(--shadow-glow); }
.part-card .part-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.part-card h3 { margin-bottom: 0.5rem; }
.part-card .part-count { color: var(--accent); font-weight: 600; font-size: 0.9rem; margin-bottom: 0.75rem; }
.part-card .part-lessons { color: var(--text-muted); font-size: 0.85rem; line-height: 1.8; }

/* --- Lessons Grid --- */
.lessons-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem; margin-top: 2rem;
}
.lesson-card {
  display: flex; align-items: center; gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none; color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.lesson-card:hover { border-color: var(--accent); background: var(--bg-card-hover); color: var(--text); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1); }
.lesson-card.locked { opacity: 0.5; cursor: not-allowed; }
.lesson-card.locked:hover { border-color: var(--border); background: var(--bg-card); box-shadow: none; }
.lesson-card.completed { border-color: rgba(16, 185, 129, 0.3); }

.lesson-num {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-weight: 700; font-size: 0.9rem;
  background: var(--bg-surface); color: var(--text-muted);
}
.lesson-card.completed .lesson-num { background: var(--success); color: white; }
.lesson-card.active .lesson-num { background: var(--accent); color: white; }
.lesson-card.locked .lesson-num { background: var(--bg-surface); color: var(--text-dim); }

.lesson-info { flex: 1; min-width: 0; }
.lesson-info h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.15rem; }
.lesson-info .lesson-meta { font-size: 0.8rem; color: var(--text-muted); }

.lesson-status { flex-shrink: 0; font-size: 1.1rem; }

/* --- Progress Section --- */
.progress-section { text-align: center; }
.progress-bar-container {
  background: var(--bg-surface);
  border-radius: 999px;
  height: 12px; width: 100%; max-width: 600px;
  margin: 1.5rem auto;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 999px;
  transition: width 0.6s ease;
  min-width: 0;
}
.progress-text { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; }

/* --- Auth Modal --- */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%; max-width: 420px;
  position: relative;
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
}
.modal h2 { margin-bottom: 1.5rem; text-align: center; }
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* --- Form Elements --- */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.4rem; }
.form-input {
  width: 100%; padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.95rem;
  transition: var(--transition);
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text-dim); }

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

.form-toggle { text-align: center; margin-top: 1rem; font-size: 0.9rem; color: var(--text-muted); }
.form-toggle a { cursor: pointer; }

/* --- About Section --- */
.about-section { text-align: center; }
.about-section p { max-width: 700px; margin: 1rem auto; color: var(--text-muted); line-height: 1.8; }
.founders { display: flex; gap: 2rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.founder-card { text-align: center; }
.founder-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; color: white;
  margin: 0 auto 0.5rem;
}
.founder-name { font-weight: 600; }
.founder-role { font-size: 0.85rem; color: var(--text-muted); }

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.footer a { color: var(--text-muted); }

/* ========== LESSON PAGE STYLES ========== */

.lesson-page { padding-top: 5rem; }

/* Lesson Header */
.lesson-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 0.5rem; opacity: 0.5; }
.lesson-title-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.lesson-title-row h1 { font-size: 1.75rem; }
.lesson-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-beginner { background: rgba(37, 99, 235, 0.1); color: var(--accent); }
.badge-intermediate { background: rgba(124, 58, 237, 0.1); color: var(--purple); }
.badge-advanced { background: rgba(234, 179, 8, 0.1); color: var(--warning); }

/* Video Section */
.video-section { padding: 2rem 0; }
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.video-container iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border: none;
}
.video-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 1.25rem; flex-wrap: wrap; gap: 1rem; }
.watch-status {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.95rem;
}
.watch-status.not-watched { color: var(--warning); }
.watch-status.watched { color: var(--success); }

/* Quiz Section */
.quiz-section {
  padding: 2.5rem 0;
  max-width: 800px;
  margin: 0 auto;
}
.quiz-locked {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.quiz-locked .lock-icon { font-size: 3rem; margin-bottom: 1rem; }
.quiz-locked p { color: var(--text-muted); }

.quiz-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.quiz-progress-bar {
  width: 100%; height: 6px;
  background: var(--bg-surface);
  border-radius: 999px;
  margin-top: 1rem; overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Question Card */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.question-number { color: var(--accent); font-weight: 700; font-size: 0.85rem; margin-bottom: 0.75rem; }
.question-text { font-size: 1.1rem; font-weight: 600; margin-bottom: 1.5rem; line-height: 1.5; }

.options-list { display: flex; flex-direction: column; gap: 0.75rem; }
.option-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}
.option-item:hover { border-color: rgba(37, 99, 235, 0.3); background: rgba(37, 99, 235, 0.03); }
.option-item.selected { border-color: var(--accent); background: rgba(37, 99, 235, 0.08); }
.option-item.correct { border-color: var(--success) !important; background: var(--success-bg) !important; }
.option-item.incorrect { border-color: var(--danger) !important; background: var(--danger-bg) !important; }
.option-item.disabled { pointer-events: none; }
.option-item.show-correct { border-color: var(--success); background: var(--success-bg); }

.option-letter {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--bg-surface);
  font-weight: 700; font-size: 0.85rem;
  color: var(--text-muted);
}
.option-item.selected .option-letter { background: var(--accent); color: white; }
.option-item.correct .option-letter { background: var(--success); color: white; }
.option-item.incorrect .option-letter { background: var(--danger); color: white; }

.option-text { font-size: 0.95rem; }

/* Feedback */
.feedback-box {
  margin-top: 1.5rem; padding: 1.25rem;
  border-radius: var(--radius);
  display: none;
}
.feedback-box.visible { display: block; }
.feedback-box.correct { background: var(--success-bg); border: 1px solid rgba(16, 185, 129, 0.3); }
.feedback-box.incorrect { background: var(--danger-bg); border: 1px solid rgba(220, 38, 38, 0.3); }
.feedback-icon { font-size: 1.25rem; margin-bottom: 0.5rem; }
.feedback-text { font-size: 0.9rem; line-height: 1.6; color: var(--text-muted); }

.quiz-actions { display: flex; gap: 1rem; margin-top: 1.5rem; justify-content: flex-end; flex-wrap: wrap; }

/* Results */
.quiz-results {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.result-score {
  font-size: 4rem; font-weight: 800;
  margin-bottom: 0.5rem;
}
.result-score.pass { color: var(--success); }
.result-score.fail { color: var(--danger); }
.result-badge {
  display: inline-block; padding: 0.4rem 1.25rem;
  border-radius: 999px; font-weight: 700;
  font-size: 0.9rem; margin-bottom: 1.5rem;
}
.result-badge.pass { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.result-badge.fail { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220, 38, 38, 0.3); }

.result-summary { margin: 2rem 0; text-align: left; }
.result-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.result-item:last-child { border-bottom: none; }
.result-item .ri-icon { flex-shrink: 0; font-size: 1.1rem; margin-top: 0.1rem; }
.result-item .ri-text { font-size: 0.9rem; }
.result-item .ri-explanation { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

.result-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }

/* --- Utility --- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar-nav { display: none; }
  .hero { padding: 6rem 0 3rem; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .lessons-grid { grid-template-columns: 1fr; }
  .parts-grid { grid-template-columns: 1fr; }
  .modal { margin: 1rem; padding: 1.5rem; }
  .question-card { padding: 1.25rem; }
  .quiz-results { padding: 2rem 1rem; }
  .lesson-title-row { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .hero-cta { flex-direction: column; align-items: center; }
  .stats-bar { grid-template-columns: 1fr 1fr; }
  .stat-item { padding: 1rem; }
  .stat-number { font-size: 1.5rem; }
}

/* --- Animations --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.6s ease forwards; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.pulse { animation: pulse 2s ease-in-out infinite; }
