@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --accent: #06b6d4;
  --bg: #f0f4ff;
  --bg2: #e8eeff;
  --surface: rgba(255,255,255,0.82);
  --surface-hover: rgba(255,255,255,0.95);
  --text: #1e1b4b;
  --text-muted: #6366f1;
  --border: rgba(99,102,241,0.18);
  --shadow: 0 8px 32px rgba(79,70,229,0.12);
  --shadow-lg: 0 20px 50px rgba(79,70,229,0.22);
  --radius: 18px;
  --radius-sm: 10px;
  --nav-h: 72px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  scroll-behavior: smooth;
}

/* ===== DARK MODE ===== */
body.dark {
  --bg: #0f0e2a;
  --bg2: #16143a;
  --surface: rgba(30,28,70,0.85);
  --surface-hover: rgba(40,38,90,0.95);
  --text: #e0e7ff;
  --text-muted: #a5b4fc;
  --border: rgba(129,140,248,0.18);
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.5);
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  color: var(--text);
  transition: background 0.4s, color 0.4s;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* ===== GLASS ===== */
.glass {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ===== NAVBAR ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  height: var(--nav-h);
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 20px rgba(79,70,229,0.08);
  transition: background 0.4s;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-logo {
  height: 38px;
  width: auto;
}

.nav-title {
  font-family: 'Sora', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  padding: 7px 14px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.nav-links a:hover {
  background: rgba(99,102,241,0.1);
  color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.22s ease;
  text-decoration: none;
  border: none;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79,70,229,0.38);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79,70,229,0.45);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover {
  background: rgba(79,70,229,0.08);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(99,102,241,0.08);
}

.btn.big {
  padding: 14px 36px;
  font-size: 1rem;
  border-radius: 12px;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.22s;
}

.theme-toggle:hover {
  background: rgba(99,102,241,0.12);
  transform: scale(1.08);
}

/* ===== HERO ===== */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 110px 20px 90px;
  overflow: hidden;
}

.hero-badge {
  display: inline-block;
  background: rgba(79,70,229,0.1);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 50px;
  margin-bottom: 24px;
  border: 1px solid rgba(79,70,229,0.2);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero h1 {
  font-family: 'Sora', sans-serif;
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto 36px;
}

.hero-cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Hero Blob */
.hero-blob {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  pointer-events: none;
  z-index: -1;
}

/* ===== STATS BAR ===== */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 60px;
  padding: 30px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-item .stat-number {
  font-family: 'Sora', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-item .stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== FEATURES SECTION ===== */
.features-section {
  padding: 90px 40px;
  position: relative;
  z-index: 1;
}

.section-header {
  text-align: center;
  margin-bottom: 56px;
}

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin-bottom: 12px;
}

.section-title {
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.7;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: left;
  box-shadow: var(--shadow);
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
  opacity: 0;
  transform: translateY(40px);
}

.feature-card.show {
  opacity: 1;
  transform: translateY(0);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(79,70,229,0.35);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  display: block;
}

.feature-card h3 {
  font-family: 'Sora', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.feature-card p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-muted);
}

/* ===== DASHBOARD / COURSES ===== */
.page-header {
  padding: 50px 40px 10px;
  position: relative;
  z-index: 1;
}

.page-header h1 {
  font-family: 'Sora', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-header p {
  color: var(--text-muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

.search-container {
  display: flex;
  justify-content: center;
  padding: 30px 40px;
  position: relative;
  z-index: 1;
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 520px;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrapper input {
  width: 100%;
  padding: 14px 20px 14px 46px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  outline: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.22s;
}

.search-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15), var(--shadow);
}

.search-wrapper input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  padding: 10px 40px 60px;
  position: relative;
  z-index: 1;
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.32s cubic-bezier(0.34,1.56,0.64,1);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.course-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(79,70,229,0.3);
}

.course-card-img {
  width: 100%;
  height: 165px;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.course-card:hover .course-card-img {
  transform: scale(1.06);
}

.course-card-img-wrap {
  overflow: hidden;
}

.course-card-body {
  padding: 20px 22px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 8px;
}

.course-card h4 {
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.35;
}

.course-card p {
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text-muted);
  flex: 1;
}

.course-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.course-card-footer .level {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.course-card-footer .arrow {
  font-size: 1rem;
  color: var(--primary);
}

.no-results {
  display: none;
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
  grid-column: 1/-1;
  font-size: 1rem;
}

/* ===== COURSE PAGE ===== */
.course-hero {
  padding: 70px 40px 50px;
  position: relative;
  z-index: 1;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 28px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--primary);
}

.course-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px 80px;
  position: relative;
  z-index: 1;
}

.course-main h1 {
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.course-main .course-desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 36px;
}

.course-section-label {
  font-family: 'Sora', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.learn-list {
  list-style: none;
  padding: 0;
  margin-bottom: 36px;
}

.learn-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
}

.learn-list li:last-child {
  border-bottom: none;
}

.learn-list li::before {
  content: '✓';
  color: var(--primary);
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

.modules-list {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
}

.module-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.module-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(79,70,229,0.12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Course Sidebar */
.course-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  height: fit-content;
}

.course-card-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.course-card-box .course-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 20px;
}

.course-meta {
  list-style: none;
  margin-bottom: 22px;
}

.course-meta li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  font-size: 0.86rem;
  border-bottom: 1px solid var(--border);
}

.course-meta li:last-child {
  border: none;
}

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

.course-meta .meta-value {
  font-weight: 600;
}

.enroll-btn {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
}

.enrolled-badge {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  background: rgba(16,185,129,0.12);
  border: 1.5px solid rgba(16,185,129,0.4);
  color: #059669;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
}

/* ===== AUTH ===== */
.auth-page {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 44px 40px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  width: 54px;
  height: auto;
  margin-bottom: 18px;
}

.auth-card h2 {
  font-family: 'Sora', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.auth-card .auth-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,0.6);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.22s, box-shadow 0.22s;
}

body.dark .form-group input {
  background: rgba(30,28,70,0.6);
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

.auth-error {
  display: none;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #dc2626;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

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

.auth-submit {
  width: 100%;
  padding: 13px;
  font-size: 0.95rem;
  margin-top: 6px;
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-link a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 56px 60px 28px;
  position: relative;
  z-index: 1;
}

.footer-container {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-col h3 {
  font-family: 'Sora', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}

.footer-col h4 {
  font-family: 'Sora', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 16px;
  color: var(--text);
}

.footer-col p {
  font-size: 0.87rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 10px;
}

.footer-col ul li a {
  font-size: 0.87rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-col ul li a:hover {
  color: var(--primary);
}

.footer-col ul li span {
  font-size: 0.87rem;
  color: var(--text-muted);
}

.footer-bottom {
  max-width: 1200px;
  margin: 30px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

/* ===== USER GREETING IN NAV ===== */
.user-greeting {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  background: rgba(79,70,229,0.08);
  border-radius: 50px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--primary);
  color: white;
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(79,70,229,0.4);
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { background: #059669; box-shadow: 0 8px 30px rgba(5,150,105,0.4); }
.toast.error { background: #dc2626; box-shadow: 0 8px 30px rgba(220,38,38,0.4); }
.toast.info { background: var(--primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .course-layout {
    grid-template-columns: 1fr;
  }
  .course-sidebar {
    position: static;
  }
  .footer-container {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 0 20px;
    flex-wrap: wrap;
    height: auto;
    padding: 14px 20px;
    gap: 12px;
  }
  .nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    flex-wrap: nowrap;
  }
  .nav-links a {
    white-space: nowrap;
    font-size: 0.82rem;
  }
  .hero {
    padding: 70px 20px 60px;
  }
  .features-section { padding: 60px 20px; }
  .courses-grid { padding: 10px 20px 50px; }
  .search-container { padding: 20px; }
  .course-hero { padding: 40px 20px 30px; }
  .course-layout { padding: 0 20px 60px; }
  .footer { padding: 40px 20px 20px; }
  .footer-container { grid-template-columns: 1fr; gap: 28px; }
  .stats-bar { gap: 30px; }
  .page-header { padding: 40px 20px 10px; }
}

/* ===== FADE ANIMATIONS ===== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34,1.2,0.64,1);
}

.fade-up.show {
  opacity: 1;
  transform: translateY(0);
}
