/* ============================================================
   TUSOME LMS — Professional E-Learning Design System
   Mobile-first · Clean · Modern
   ============================================================ */

:root {
  /* Brand */
  --ts-primary: #2563eb;
  --ts-primary-dark: #1d4ed8;
  --ts-primary-light: #3b82f6;
  --ts-primary-soft: #eff6ff;
  --ts-accent: #7c3aed;
  --ts-accent-soft: #f5f3ff;

  /* Semantic */
  --ts-success: #059669;
  --ts-success-soft: #ecfdf5;
  --ts-warning: #d97706;
  --ts-warning-soft: #fffbeb;
  --ts-danger: #dc2626;
  --ts-danger-soft: #fef2f2;
  --ts-info: #0891b2;

  /* Neutrals */
  --ts-ink: #0f172a;
  --ts-ink-2: #1e293b;
  --ts-muted: #64748b;
  --ts-muted-2: #94a3b8;
  --ts-border: #e2e8f0;
  --ts-border-soft: #f1f5f9;
  --ts-bg: #f8fafc;
  --ts-bg-elevated: #ffffff;
  --ts-surface: #ffffff;

  /* Layout */
  --ts-radius: 12px;
  --ts-radius-sm: 8px;
  --ts-radius-lg: 16px;
  --ts-radius-xl: 24px;
  --ts-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --ts-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --ts-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  --ts-nav-h: 64px;

  /* Type */
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ts-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --ts-gradient-soft: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--ts-ink);
  background: var(--ts-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ts-ink);
  line-height: 1.25;
}

p { color: var(--ts-muted); }

a { color: var(--ts-primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--ts-primary-dark); }

img { max-width: 100%; height: auto; }

:focus-visible {
  outline: 2px solid var(--ts-primary);
  outline-offset: 2px;
}

/* ---------- Navigation ---------- */
.navbar.ts-nav,
.navbar.bg-primary {
  background: var(--ts-ink) !important;
  min-height: var(--ts-nav-h);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}

.navbar-brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  color: #fff !important;
}

.navbar-brand i {
  background: var(--ts-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  font-size: 0.925rem;
  padding: 0.5rem 0.85rem !important;
  border-radius: var(--ts-radius-sm);
  transition: color 0.15s, background 0.15s;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.navbar .btn-light {
  background: #fff;
  color: var(--ts-ink);
  border: none;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
}

.navbar .btn-light:hover {
  background: var(--ts-primary-soft);
  color: var(--ts-primary);
}

.navbar-toggler {
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.4rem 0.55rem;
}

.dropdown-menu {
  border: 1px solid var(--ts-border);
  border-radius: var(--ts-radius);
  box-shadow: var(--ts-shadow-lg);
  padding: 0.4rem;
  min-width: 220px;
}

.dropdown-item {
  border-radius: var(--ts-radius-sm);
  padding: 0.55rem 0.85rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.dropdown-item:hover { background: var(--ts-primary-soft); color: var(--ts-primary); }
.dropdown-item i { width: 1.25rem; opacity: 0.7; }

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--ts-radius-sm);
  font-weight: 600;
  font-size: 0.925rem;
  padding: 0.55rem 1.2rem;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--ts-primary);
  border-color: var(--ts-primary);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--ts-primary-dark);
  border-color: var(--ts-primary-dark);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-success {
  background: var(--ts-success);
  border-color: var(--ts-success);
}

.btn-outline-primary {
  color: var(--ts-primary);
  border-color: var(--ts-primary);
}

.btn-outline-primary:hover {
  background: var(--ts-primary);
  border-color: var(--ts-primary);
}

.btn-lg {
  padding: 0.75rem 1.6rem;
  font-size: 1rem;
  border-radius: var(--ts-radius);
}

.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.85rem; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--ts-border);
  border-radius: var(--ts-radius-lg);
  background: var(--ts-surface);
  box-shadow: var(--ts-shadow);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--ts-border);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.card-body { padding: 1.25rem; }

.shadow-soft {
  box-shadow: var(--ts-shadow-md) !important;
  border: 1px solid var(--ts-border);
}

/* Course cards */
.course-card {
  border: 1px solid var(--ts-border);
  border-radius: var(--ts-radius-lg);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  height: 100%;
  background: var(--ts-surface);
  box-shadow: var(--ts-shadow);
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--ts-shadow-lg);
  border-color: #cbd5e1;
}

.course-card .card-img-top,
.course-card .card-img-placeholder {
  height: 160px;
  object-fit: cover;
  background: var(--ts-gradient-soft);
}

.course-card .card-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.course-card .price-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--ts-ink);
  color: #fff;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  box-shadow: var(--ts-shadow-md);
}

.course-card .level-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  background: var(--ts-primary-soft) !important;
  color: var(--ts-primary) !important;
}

.course-card .card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.course-card .card-title a { color: var(--ts-ink); }
.course-card .card-title a:hover { color: var(--ts-primary); }

.course-card .card-body {
  display: flex;
  flex-direction: column;
  padding: 1.1rem;
}

/* ---------- Hero ---------- */
.hero-section {
  background: var(--ts-ink);
  color: #fff;
  padding: 4rem 0 4.5rem;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 80% 20%, rgba(37, 99, 235, 0.35), transparent),
    radial-gradient(ellipse 60% 50% at 10% 80%, rgba(124, 58, 237, 0.25), transparent);
  pointer-events: none;
}

.hero-section .container { position: relative; z-index: 1; }

.hero-section h1 {
  font-size: clamp(1.85rem, 5vw, 3rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero-section .lead {
  color: rgba(255,255,255,0.78);
  font-size: 1.1rem;
  max-width: 32rem;
}

.hero-section .btn-light {
  background: #fff;
  color: var(--ts-ink);
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
}

.hero-section .btn-outline-light {
  border-radius: 999px;
  border-width: 1.5px;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
}

/* ---------- Sections ---------- */
.section-title {
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.section-sub {
  color: var(--ts-muted);
  margin-bottom: 0;
}

/* Feature / step cards */
.feature-card {
  background: var(--ts-surface);
  border: 1px solid var(--ts-border);
  border-radius: var(--ts-radius-lg);
  padding: 1.5rem;
  height: 100%;
  transition: box-shadow 0.2s, transform 0.2s;
}

.feature-card:hover {
  box-shadow: var(--ts-shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ts-primary-soft);
  color: var(--ts-primary);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ts-gradient);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

/* ---------- Dashboard stats ---------- */
.dashboard-stat {
  background: var(--ts-surface);
  border: 1px solid var(--ts-border);
  border-radius: var(--ts-radius-lg);
  padding: 1.25rem;
  box-shadow: var(--ts-shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  height: 100%;
}

.dashboard-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--ts-shadow-md);
}

.dashboard-stat .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.dashboard-stat .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ts-ink);
  line-height: 1.2;
}

.dashboard-stat .stat-label {
  font-size: 0.8rem;
  color: var(--ts-muted);
  font-weight: 500;
}

/* ---------- Progress ---------- */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--ts-border-soft);
  overflow: hidden;
}

.progress-bar {
  background: var(--ts-gradient);
  border-radius: 999px;
}

.progress-lg { height: 10px; }

/* ---------- Course player ---------- */
.course-player {
  display: flex;
  min-height: calc(100vh - var(--ts-nav-h));
  background: var(--ts-bg);
}

.course-sidebar {
  width: 300px;
  background: var(--ts-surface);
  border-right: 1px solid var(--ts-border);
  overflow-y: auto;
  max-height: calc(100vh - var(--ts-nav-h));
  position: sticky;
  top: var(--ts-nav-h);
  flex-shrink: 0;
}

.course-sidebar .p-3.border-bottom {
  background: var(--ts-bg);
}

.module-header {
  background: var(--ts-bg);
  padding: 0.65rem 1rem;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ts-muted);
  border-bottom: 1px solid var(--ts-border);
}

.lesson-item {
  display: flex;
  align-items: center;
  padding: 0.7rem 1rem 0.7rem 1.15rem;
  border-bottom: 1px solid var(--ts-border-soft);
  color: var(--ts-ink-2);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.12s, color 0.12s;
}

.lesson-item:hover {
  background: var(--ts-primary-soft);
  color: var(--ts-primary);
}

.lesson-item.active {
  background: var(--ts-primary-soft);
  color: var(--ts-primary);
  font-weight: 600;
  border-left: 3px solid var(--ts-primary);
  padding-left: calc(1.15rem - 3px);
}

.lesson-item.locked {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.lesson-item .status-icon {
  width: 22px;
  margin-right: 10px;
  text-align: center;
  flex-shrink: 0;
}

.course-content {
  flex: 1;
  padding: 1.5rem 1.75rem;
  max-width: 960px;
}

/* Video */
.video-wrapper {
  position: relative;
  background: #0f172a;
  border-radius: var(--ts-radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: var(--ts-shadow-lg);
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Quiz ---------- */
.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.9rem 1.1rem;
  border: 1.5px solid var(--ts-border);
  border-radius: var(--ts-radius);
  margin-bottom: 0.65rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  font-weight: 500;
  color: var(--ts-ink-2);
}

.quiz-option:hover {
  border-color: var(--ts-primary-light);
  background: var(--ts-primary-soft);
}

.quiz-option:has(input:checked) {
  border-color: var(--ts-primary);
  background: var(--ts-primary-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.quiz-option input {
  margin-top: 0.2rem;
  accent-color: var(--ts-primary);
}

.quiz-option.correct {
  border-color: var(--ts-success);
  background: var(--ts-success-soft);
}

.quiz-option.incorrect {
  border-color: var(--ts-danger);
  background: var(--ts-danger-soft);
}

/* ---------- Auth ---------- */
.auth-wrapper {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  background: var(--ts-gradient-soft);
}

.auth-card {
  max-width: 440px;
  width: 100%;
  border: 1px solid var(--ts-border);
  border-radius: var(--ts-radius-xl);
  box-shadow: var(--ts-shadow-lg);
  background: #fff;
}

.auth-card .form-control {
  border-radius: var(--ts-radius-sm);
  border-color: var(--ts-border);
  padding: 0.65rem 0.9rem;
}

.auth-card .form-control:focus {
  border-color: var(--ts-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.auth-card .form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ts-ink-2);
}

/* ---------- Payment ---------- */
.payment-status {
  text-align: center;
  padding: 3rem 1.5rem;
}

.payment-status .spinner-border {
  width: 2.75rem;
  height: 2.75rem;
  color: var(--ts-primary);
}

/* ---------- Admin ---------- */
.admin-sidebar {
  min-height: calc(100vh - var(--ts-nav-h));
  background: var(--ts-ink);
  color: #cbd5e1;
  width: 240px;
  position: sticky;
  top: var(--ts-nav-h);
}

.admin-sidebar .nav-link {
  color: #94a3b8;
  padding: 0.65rem 1.15rem;
  border-radius: 0;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.admin-sidebar .nav-link i { width: 22px; opacity: 0.85; }

/* ---------- Tables ---------- */
.table {
  --bs-table-bg: transparent;
  font-size: 0.9rem;
}

.table thead th {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ts-muted);
  border-bottom-width: 1px;
  background: var(--ts-bg);
}

.table > :not(caption) > * > * {
  padding: 0.85rem 1rem;
  vertical-align: middle;
}

/* ---------- Badges ---------- */
.badge {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  padding: 0.35em 0.65em;
  border-radius: 6px;
}

/* ---------- Alerts / flash ---------- */
.alert {
  border-radius: var(--ts-radius);
  border: 1px solid transparent;
  font-size: 0.925rem;
}

.alert-success { background: var(--ts-success-soft); border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: var(--ts-danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--ts-warning-soft); border-color: #fde68a; color: #92400e; }
.alert-info { background: #ecfeff; border-color: #a5f3fc; color: #155e75; }

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-state i {
  font-size: 2.75rem;
  color: var(--ts-muted-2);
  margin-bottom: 1rem;
  display: block;
}

.empty-state h5 {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.empty-state p {
  color: var(--ts-muted);
  max-width: 28rem;
  margin: 0 auto 1.25rem;
}

/* ---------- Footer ---------- */
footer.bg-dark {
  background: var(--ts-ink) !important;
  margin-top: auto;
}

footer h5, footer h6 { color: #fff; }

footer a.text-secondary:hover { color: #fff !important; }

footer .text-secondary { color: #94a3b8 !important; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-color: var(--ts-border);
  border-radius: var(--ts-radius-sm);
  font-size: 0.925rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--ts-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-label { font-weight: 600; font-size: 0.875rem; color: var(--ts-ink-2); }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.breadcrumb-item a { color: var(--ts-muted); }
.breadcrumb-item a:hover { color: var(--ts-primary); }
.breadcrumb-item.active { color: var(--ts-ink); font-weight: 500; }

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--ts-gradient);
  color: #fff;
  padding: 3.5rem 0;
  text-align: center;
}

.cta-band h2 { color: #fff; font-weight: 800; }
.cta-band p { color: rgba(255,255,255,0.85); }

/* ---------- Certificate verify ---------- */
.cert-verify-card {
  border-radius: var(--ts-radius-xl);
  border: 1px solid var(--ts-border);
  box-shadow: var(--ts-shadow-lg);
}

.cert-valid-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--ts-success-soft);
  color: #065f46;
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 1px solid #a7f3d0;
}

/* ---------- Enrollment progress row ---------- */
.enroll-row {
  border: 1px solid var(--ts-border);
  border-radius: var(--ts-radius);
  padding: 1rem;
  background: var(--ts-surface);
  transition: box-shadow 0.15s;
}

.enroll-row:hover { box-shadow: var(--ts-shadow-md); }

/* ---------- Loading ---------- */
.ts-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--ts-border);
  border-top-color: var(--ts-primary);
  border-radius: 50%;
  animation: ts-spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes ts-spin {
  to { transform: rotate(360deg); }
}

.btn .ts-spinner {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
  margin-right: 0.4rem;
}

/* ---------- Utilities ---------- */
.bg-gradient-primary { background: var(--ts-gradient) !important; }
.rounded-xl { border-radius: var(--ts-radius-lg) !important; }
.rounded-2xl { border-radius: var(--ts-radius-xl) !important; }
.text-muted { color: var(--ts-muted) !important; }
.fw-800 { font-weight: 800 !important; }

/* Page shell */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  margin-bottom: 0.25rem;
}

/* ---------- Mobile ---------- */
@media (max-width: 991.98px) {
  .course-player {
    flex-direction: column;
  }

  .course-sidebar {
    width: 100%;
    max-height: 280px;
    position: relative;
    top: 0;
    border-right: none;
    border-bottom: 1px solid var(--ts-border);
  }

  .course-content {
    padding: 1.15rem;
  }

  .admin-sidebar {
    width: 100%;
    position: relative;
    top: 0;
    min-height: auto;
  }

  .hero-section {
    padding: 3rem 0 3.5rem;
  }

  .navbar-collapse {
    background: var(--ts-ink);
    padding: 0.75rem 0 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
  }

  .navbar-nav .nav-link {
    padding: 0.65rem 0.5rem !important;
  }
}

@media (max-width: 575.98px) {
  .course-card .card-img-top,
  .course-card .card-img-placeholder {
    height: 140px;
  }

  .btn-lg {
    width: 100%;
  }

  .dashboard-stat .stat-value {
    font-size: 1.25rem;
  }

  .auth-wrapper {
    padding: 1.5rem 0.75rem;
  }
}

/* Print */
@media print {
  .navbar, footer, .course-sidebar { display: none !important; }
  .course-content { max-width: 100%; }
}
