/* ===================================================================
   EduTest Pro - Custom Design System & SaaS Stylesheet
   Modern Education SaaS theme with Glassmorphism & High-Fi Print CSS
   =================================================================== */

:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.15);

  --secondary-color: #0ea5e9;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #06b6d4;
  --purple-color: #8b5cf6;

  --sidebar-width: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active-bg: #1e293b;
  --sidebar-active-text: #ffffff;

  --topbar-height: 70px;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-dark);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* ================= Topbar & Layout ================= */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1040;
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.sidebar-brand i {
  color: #818cf8;
  margin-right: 0.75rem;
  font-size: 1.5rem;
}

.sidebar-nav {
  list-style: none;
  padding: 1rem 0.75rem;
  margin: 0;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: #64748b;
  padding: 0.75rem 0.75rem 0.25rem;
}

.nav-item {
  margin-bottom: 0.25rem;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.85rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.nav-link-custom i {
  font-size: 1.15rem;
  margin-right: 0.75rem;
  color: #94a3b8;
  transition: color 0.2s;
}

.nav-link-custom:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.nav-link-custom:hover i {
  color: #818cf8;
}

.nav-link-custom.active {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.nav-link-custom.active i {
  color: #ffffff;
}

.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  height: var(--topbar-height);
  background-color: #ffffff;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.app-content {
  padding: 1.5rem;
  flex-grow: 1;
}

/* ================= Cards & Stats ================= */
.stat-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-right: 1.25rem;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-custom {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

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

/* ================= Modern Badges ================= */
.bg-purple {
  background-color: #8b5cf6 !important;
  color: #fff;
}
.text-purple {
  color: #8b5cf6 !important;
}

/* ================= Rich Question Styling & Math ================= */
.math-preview {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  padding: 1rem;
  min-height: 50px;
}

.question-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  transition: all 0.2s;
}

.question-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.option-pill {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: #f8fafc;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
}

.option-pill.correct {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 600;
}

.option-tag {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  margin-right: 0.65rem;
  flex-shrink: 0;
}

.option-pill.correct .option-tag {
  background: #10b981;
  color: #fff;
}

/* ================= Wizard Stepper ================= */
.step-item {
  flex: 1;
  text-align: center;
  position: relative;
  padding-bottom: 0.5rem;
}

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #e2e8f0;
  z-index: 1;
}

.step-item.active:not(:last-child)::after,
.step-item.completed:not(:last-child)::after {
  background: #4f46e5;
}

.step-bubble {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 0.35rem;
  position: relative;
  z-index: 2;
  transition: all 0.2s ease;
}

.step-item.active .step-bubble {
  border-color: #4f46e5;
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
}

.step-item.completed .step-bubble {
  border-color: #10b981;
  background: #10b981;
  color: #ffffff;
}

.step-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.step-item.active .step-label {
  color: #4f46e5;
  font-weight: 700;
}

/* ================= High-Fidelity Printable Test Paper CSS ================= */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
    font-family: 'Times New Roman', Times, serif;
    margin: 0;
    padding: 0;
  }

  .no-print,
  .app-sidebar,
  .app-topbar,
  .btn,
  .modal,
  footer {
    display: none !important;
  }

  .app-wrapper,
  .app-main,
  .app-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .print-paper-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .paper-page {
    page-break-after: always;
    position: relative;
    padding: 1.5cm;
  }

  .paper-question-block {
    page-break-inside: avoid;
    margin-bottom: 1rem;
  }
}

.print-paper-sheet {
  max-width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  background: #ffffff;
  padding: 2.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
}

.exam-header-box {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.exam-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  font-size: 0.9rem;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  padding: 0.5rem 0;
  margin-bottom: 1.25rem;
}

/* Responsive Mobile Sidebar */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    height: 100vh;
  }

  .app-sidebar.show {
    left: 0;
  }

  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1030;
    display: none;
  }

  .sidebar-backdrop.show {
    display: block;
  }
}
