/* ==========================================================================
   Examly Design System
   Modern Indigo/Violet SaaS theme for the exam portal
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@500;600;700;800&display=swap');

:root {
  --color-primary: #4F46E5;
  --color-primary-dark: #4338CA;
  --color-primary-darker: #3730A3;
  --color-primary-light: #EEF2FF;
  --color-accent: #7C3AED;

  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-text: #1E293B;
  --color-text-muted: #64748B;
  --color-border: #E2E8F0;

  --color-success: #16A34A;
  --color-danger: #DC2626;
  --color-warning: #F59E0B;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 16px -4px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 20px 40px -12px rgba(79, 70, 229, 0.25);

  --gradient-brand: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
}

/* ---------------------------------------------------------------------- */
/* Base                                                                    */
/* ---------------------------------------------------------------------- */
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

h1, h2, h3, h4, h5, h6,
.navbar-brand, .card-title, .display-1, .display-2,
.display-3, .display-4, .display-5, .display-6 {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
}

a { color: var(--color-primary); }
a:hover { color: var(--color-primary-dark); }

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */
.btn { border-radius: var(--radius-sm); font-weight: 500; }

.btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--color-primary-dark) !important;
  border-color: var(--color-primary-dark) !important;
}

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

.btn-cta {
  background: var(--gradient-brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.75rem 2rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 45px -12px rgba(79, 70, 229, 0.35);
  color: #fff;
}

.btn-cta-outline {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-pill);
  padding: 0.75rem 2rem;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease;
}
.btn-cta-outline:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: translateY(-2px);
}

/* ---------------------------------------------------------------------- */
/* Color helpers (override Bootstrap defaults for brand consistency)      */
/* ---------------------------------------------------------------------- */
.text-primary { color: var(--color-primary) !important; }
.bg-primary { background-color: var(--color-primary) !important; }
.border-primary { border-color: var(--color-primary) !important; }

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

.bg-gradient-brand { background: var(--gradient-brand); }

/* ---------------------------------------------------------------------- */
/* Cards                                                                   */
/* ---------------------------------------------------------------------- */
.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.feature-card, .exam-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.feature-card:hover, .exam-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
}

/* ---------------------------------------------------------------------- */
/* Forms                                                                   */
/* ---------------------------------------------------------------------- */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--color-border);
  padding: 0.6rem 0.9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}
.form-label { font-weight: 500; color: var(--color-text); }

/* ---------------------------------------------------------------------- */
/* Navbar                                                                  */
/* ---------------------------------------------------------------------- */
.navbar-examly {
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.navbar-examly .navbar-shell {
  max-width: 1480px;
  padding-left: clamp(1rem, 3vw, 2rem);
  padding-right: clamp(1rem, 3vw, 2rem);
}
.navbar-examly .navbar-brand {
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.navbar-examly .brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.navbar-examly .nav-link {
  color: var(--color-text-muted);
  font-weight: 500;
  margin-right: 0.25rem;
  border-radius: var(--radius-pill);
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}
.navbar-examly .nav-link:hover,
.navbar-examly .nav-link.active {
  color: var(--color-primary) !important;
  background: var(--color-primary-light);
}
.navbar-examly .portal-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: #F8FAFC;
  white-space: nowrap;
}
.navbar-examly .portal-switcher-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.navbar-examly .portal-switcher-link:hover {
  color: var(--color-primary);
}
.navbar-examly .portal-switcher-link.active {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.navbar-examly .role-badge {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.navbar-examly .btn-login {
  background: var(--gradient-brand);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 0.45rem 1.4rem;
  font-weight: 600;
  border: none;
}
.navbar-examly .btn-login:hover { color: #fff; opacity: 0.92; }
.navbar-examly .btn-logout {
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  border-radius: var(--radius-pill);
  padding: 0.45rem 1.4rem;
  font-weight: 500;
}
.navbar-examly .btn-logout:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.app-shell {
  --app-navbar-height: 68px;
  background: #0d0d1a;
}
.app-shell .navbar-examly {
  top: 0;
  z-index: 1100;
  min-height: var(--app-navbar-height);
  background: #111120;
  border-bottom: 1px solid #1e1e35;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}
.app-shell .navbar-examly .navbar-brand {
  color: #f8f8ff;
}
.app-shell .navbar-examly .nav-link {
  color: #a5a5d6;
}
.app-shell .navbar-examly .nav-link:hover,
.app-shell .navbar-examly .nav-link.active {
  background: #1a1a32;
  color: #ffffff !important;
}
.app-shell .navbar-examly .nav-link.active {
  box-shadow: inset 0 -2px 0 #5b5cff;
}
.app-shell .navbar-examly .portal-switcher {
  background: #0d0d1a;
  border-color: #272752;
}
.app-shell .navbar-examly .portal-switcher-link {
  color: #a7a7dd;
}
.app-shell .navbar-examly .portal-switcher-link:hover {
  color: #ffffff;
}
.app-shell .navbar-examly .portal-switcher-link.active {
  background: linear-gradient(135deg, #4a46f3 0%, #6938d8 100%);
  color: #ffffff;
}
.app-shell .navbar-examly .role-badge {
  background: #191938;
  color: #bdbdff;
}
.app-shell .navbar-examly .btn-logout {
  border-color: #303055;
  color: #d4d4ee;
}
.app-shell .navbar-examly .btn-logout:hover {
  background: rgba(220, 38, 38, 0.12);
}
.app-shell .erp-sidebar,
.app-shell .management-sidebar {
  top: var(--app-navbar-height) !important;
  z-index: 800;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  will-change: transform;
}
.app-shell .erp-content,
.app-shell .management-content {
  min-height: calc(100vh - var(--app-navbar-height)) !important;
  border-top: 1px solid #15152a;
  transition: margin-left 0.22s ease, padding-left 0.22s ease;
}
.sidebar-toggle {
  display: none;
}
.app-shell .sidebar-toggle {
  display: flex;
  position: fixed;
  top: calc(var(--app-navbar-height) + 14px);
  left: 214px;
  z-index: 900;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid #303060;
  border-radius: 10px;
  background: #18182d;
  color: #d6d6ff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
  transition: left 0.22s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.app-shell .sidebar-toggle:hover {
  background: #20203d;
  border-color: #5b5cff;
  color: #ffffff;
}
.app-shell.sidebar-collapsed .erp-sidebar,
.app-shell.sidebar-collapsed .management-sidebar {
  transform: translateX(-100%) !important;
}
.app-shell.sidebar-collapsed .erp-content,
.app-shell.sidebar-collapsed .management-content {
  margin-left: 0 !important;
}
.app-shell.sidebar-collapsed .sidebar-toggle {
  left: 14px;
}

@media (max-width: 991.98px) {
  .app-shell .erp-sidebar,
  .app-shell .management-sidebar {
    transform: translateX(-100%);
    box-shadow: 18px 0 35px rgba(0, 0, 0, 0.35);
  }

  .app-shell:not(.sidebar-collapsed) .erp-sidebar,
  .app-shell:not(.sidebar-collapsed) .management-sidebar {
    transform: translateX(0);
  }

  .app-shell .erp-content,
  .app-shell .management-content {
    margin-left: 0 !important;
  }

  .app-shell .sidebar-toggle {
    left: 14px;
  }

  .app-shell:not(.sidebar-collapsed) .sidebar-toggle {
    left: 214px;
  }
}

@media (max-width: 1199.98px) {
  .navbar-examly .navbar-nav {
    gap: 0.35rem;
    padding-top: 0.75rem;
  }

  .navbar-examly .nav-link,
  .navbar-examly .portal-switcher,
  .navbar-examly .role-badge,
  .navbar-examly .btn-logout {
    width: 100%;
  }

  .navbar-examly .portal-switcher-link {
    flex: 1;
    justify-content: center;
  }
}

/* ---------------------------------------------------------------------- */
/* Footer                                                                  */
/* ---------------------------------------------------------------------- */
.footer-examly {
  background: #0d0d1a;
  border-top: 1px solid #1e1e35;
  color: #9090b8;
  margin-top: auto;
}
.footer-examly h5 {
  color: #fff;
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}
.footer-examly a {
  color: #a5a5d6;
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-examly a:hover { color: #0dcaf0; }
.footer-examly .footer-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 0.75rem;
}
.footer-examly .brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.footer-examly .social-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #14142b;
  border: 1px solid #242448;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.footer-examly .social-icon:hover {
  background: #1e1e3d;
  border-color: #0dcaf0;
  transform: translateY(-3px);
}
.footer-examly hr { border-color: #1e1e35; opacity: 1; }

/* ---------------------------------------------------------------------- */
/* Hero                                                                    */
/* ---------------------------------------------------------------------- */
.hero-section {
  background: var(--gradient-brand);
  border-radius: var(--radius-lg);
  color: #fff;
  overflow: hidden;
  position: relative;
}
.hero-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255,255,255,0.15), transparent 55%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ---------------------------------------------------------------------- */
/* Auth pages (login / signup)                                            */
/* ---------------------------------------------------------------------- */
.auth-wrapper {
  min-height: calc(100vh - 250px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  display: flex;
  width: 100%;
  max-width: 960px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.auth-side {
  flex: 1;
  background: var(--gradient-brand);
  color: #fff;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.auth-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at bottom left, rgba(255,255,255,0.15), transparent 60%);
}
.auth-side .auth-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
}
.auth-form-side {
  flex: 1;
  padding: 3rem 2.5rem;
}
.auth-role-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.auth-role-tabs a {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s ease;
}
.auth-role-tabs a.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.auth-input-group .input-group-text {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

@media (max-width: 767.98px) {
  .auth-side { display: none; }
}

/* ---------------------------------------------------------------------- */
/* Simple centered card (password reset, status pages)                    */
/* ---------------------------------------------------------------------- */
.simple-card-wrapper {
  min-height: calc(100vh - 250px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.simple-card {
  width: 100%;
  max-width: 460px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.75rem 2.5rem;
}
.simple-card .auth-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 1.25rem;
}

/* ---------------------------------------------------------------------- */
/* Dashboards                                                              */
/* ---------------------------------------------------------------------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}
.page-header h2 {
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.page-header p {
  color: var(--color-text-muted);
  margin-bottom: 0;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
}
.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-card .stat-value {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--color-text);
}
.stat-card .stat-label {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.dashboard-action-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
  height: 100%;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.dashboard-action-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

/* Tables */
.table-examly {
  --bs-table-bg: transparent;
}
.table-examly thead th {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
  border-bottom: none;
  white-space: nowrap;
}
.table-examly tbody tr:hover {
  background-color: var(--color-primary-light);
}

/* Soft status badges */
.badge-soft-success {
  background: rgba(22, 163, 74, 0.12);
  color: var(--color-success);
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
}
.badge-soft-danger {
  background: rgba(220, 38, 38, 0.12);
  color: var(--color-danger);
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
}
.badge-soft-warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--color-warning);
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
}
.badge-soft-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
}

/* Pagination */
.pagination .page-link {
  color: var(--color-primary);
  border-color: var(--color-border);
}
.pagination .page-link:hover {
  color: var(--color-primary-dark);
  background-color: var(--color-primary-light);
}
.pagination .page-item.active .page-link {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.pagination .page-item.disabled .page-link {
  color: var(--color-text-muted);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--color-text-muted);
}
.empty-state i {
  font-size: 3rem;
  color: var(--color-border);
  margin-bottom: 1rem;
  display: block;
}

/* ---------------------------------------------------------------------- */
/* Misc                                                                    */
/* ---------------------------------------------------------------------- */
#backToTop {
  background: var(--gradient-brand);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.section-title {
  font-weight: 700;
}
.section-subtitle {
  color: var(--color-text-muted);
}
