/* ── App-wide green theme variables ─────────────────────────────────────── */
:root {
  --app-green:       #0C32BE;
  --app-green-mid:   #2984ce;
  --app-green-light: #8dbef5;
  --app-green-dark:  #1E44AA;
  --app-green-900:   #052e16;
}

/* ── Brand logo ──────────────────────────────────────────────────────────── */
.brand-logo {
    height: 36px;
    width: auto;
    display: block;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-logo-sidebar {
    height: 28px;
}

/* Stacked brand: text line + logo below */
.lp-brand-stacked {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: .15rem !important;
    line-height: 1.1;
}

.brand-logo-below {
    height: 200px;
    width: auto;
    display: block;
    object-fit: contain;
}

.brand-text {
    display: inline;
}

@media (max-width: 575px) {
    .brand-logo {
        height: 28px;
    }
    .brand-text {
        display: none;
    }
}

/* ── Base typography ──────────────────────────────────────────────────────── */
html {
  font-size: 15px;
  height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 0;
  background-color: #f4f6f9;
  color: #1e2a3a;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ── Focus rings ─────────────────────────────────────────────────────────── */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--app-green);
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar-brand {
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}

.navbar-dark .navbar-nav .nav-link {
  font-size: 0.9rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  transition: color 0.15s;
}

.navbar-dark .navbar-nav .nav-link.active,
.navbar-dark .navbar-nav .nav-link.active.fw-semibold {
  color: #fff !important;
  border-bottom: 2px solid var(--app-green-mid);
}

.navbar-dark .navbar-nav .dropdown-menu .dropdown-item.active {
  background-color: var(--app-green-dark);
  color: #fff;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #e9eef5;
  border-radius: 0.75rem 0.75rem 0 0 !important;
  font-weight: 600;
  color: #1e2a3a;
}

/* ── Stat cards (dashboard) ──────────────────────────────────────────────── */
.stat-card {
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.stat-card .stat-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: #1e2a3a;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: #6b7a8d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.1rem;
}

/* ── Exam status badges ──────────────────────────────────────────────────── */
.exam-status-available  { background: #dcfce7; color: #166534; }
.exam-status-upcoming   { background: #dcfce7; color: #0b0a4e; }
.exam-status-completed  { background: #d1fae5; color: #065f46; }
.exam-status-expired    { background: #f1f5f9; color: #64748b; }
.exam-status-cancelled  { background: #fee2e2; color: #991b1b; }

/* ── Exam cards on candidate dashboard ──────────────────────────────────── */
.exam-card {
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  transition: box-shadow 0.2s, transform 0.2s;
  overflow: hidden;
}

.exam-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.11);
  transform: translateY(-2px);
}

.exam-card .exam-card-accent {
  height: 4px;
  width: 100%;
}

/* ── Section list in exam player ─────────────────────────────────────────── */
.section-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #f0f4f8;
  background: #fff;
  transition: background 0.1s;
}

.section-row:last-child { border-bottom: none; }
.section-row:hover { background: #f8fafc; }

/* ── Exam player timer bar ───────────────────────────────────────────────── */
.exam-header-bar {
  background: var(--app-green-dark);
  color: #fff;
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.timer-badge {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.35rem 1rem;
  border-radius: 2rem;
  letter-spacing: 0.04em;
  min-width: 5.5rem;
  text-align: center;
}

.timer-badge.running  { background: #ef4444; color: #fff; }
.timer-badge.warning  { background: #f59e0b; color: #1e2a3a; }
.timer-badge.done     { background: #22c55e; color: #fff; }

/* ── Question cards ──────────────────────────────────────────────────────── */
.question-card {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  border-left: 3px solid transparent;
  transition: border-color 0.2s;
}

.question-card.answered { border-left-color: #22c55e; }

.question-card .question-number {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--app-green);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.question-card .passage-block {
  background: var(--app-green-light);
  border-left: 3px solid var(--app-green-mid);
  border-radius: 0 0.375rem 0.375rem 0;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--app-green-dark);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.question-card .option-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.5rem;
  cursor: pointer;
  margin-bottom: 0.3rem;
  border: 1.5px solid #e5e9f0;
  transition: background 0.15s, border-color 0.15s;
}

.question-card .option-item:hover {
  background: var(--app-green-light);
  border-color: var(--app-green-mid);
}

.question-card .option-item input[type=radio]:checked + label,
.question-card .option-item:has(input:checked) {
  background: var(--app-green-light);
  border-color: var(--app-green);
}

/* ── Score display (result page) ─────────────────────────────────────────── */
.score-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
}

.score-ring-value {
  font-size: 3rem;
  font-weight: 800;
  color: #1e2a3a;
  line-height: 1;
}

.score-ring-pct {
  font-size: 1.2rem;
  color: var(--app-green);
  font-weight: 600;
  margin-top: 0.25rem;
}

.score-ring-label {
  font-size: 0.8rem;
  color: #6b7a8d;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.25rem;
}

.section-score-bar {
  height: 6px;
  border-radius: 3px;
  background: #e5e9f0;
  overflow: hidden;
  margin-top: 0.3rem;
}

.section-score-bar .fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--app-green), var(--app-green-mid));
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  padding: 1rem 0;
  background: #fff;
  border-top: 1px solid #e9eef5;
  color: #6b7a8d;
  font-size: 0.85rem;
  margin-top: 2rem;
}

/* ── Page heading strip ──────────────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--app-green-dark) 0%, var(--app-green) 100%);
  color: #fff;
  border-radius: 0.75rem;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.75rem;
}

.page-hero h1, .page-hero h2 {
  color: #fff;
  margin: 0;
  font-weight: 700;
}

.page-hero p {
  margin: 0.3rem 0 0;
  opacity: 0.8;
  font-size: 0.93rem;
}

/* ── Alert variants ──────────────────────────────────────────────────────── */
.alert { border-radius: 0.625rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { border-radius: 0.5rem; }
.btn-primary  { background: var(--app-green); border-color: var(--app-green); }
.btn-primary:hover  { background: var(--app-green-dark); border-color: var(--app-green-dark); }
.btn-success  { background: var(--app-green-dark); border-color: var(--app-green-dark); }
.btn-success:hover  { background: #15803d; border-color: #15803d; }

/* ── Fraud warning overlay ───────────────────────────────────────────────── */
#fraud-warning-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  max-width: 26rem;
  z-index: 1055;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  border-radius: 0.75rem;
}

/* ── Admin Sidebar Layout ──────────────────────────────────────────────────── */
body.admin-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.admin-layout > div {
  display: flex;
  flex: 1;
}

.admin-sidebar {
  width: 260px;
  background-color: var(--app-green-dark);
  color: #fff;
  min-height: calc(100vh - 80px); /* Adjust for footer */
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  padding-bottom: 80px; /* Space for fixed footer section */
  z-index: 1000;
}

.admin-main {
  margin-left: 260px;
  flex: 1;
  background-color: #f4f6f9;
  min-height: calc(100vh - 60px);
}

/* Sidebar Header */
.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.sidebar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  display: block;
}

.sidebar-subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* Sidebar Navigation */
.sidebar-nav {
  padding: 1rem 0.5rem;
  flex: 1;
}

.sidebar-nav .nav-item {
  margin-bottom: 0.25rem;
}

.sidebar-nav .nav-link {
  color: rgba(255, 255, 255, 0.8);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.sidebar-nav .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid var(--app-green-mid);
  padding-left: calc(1rem - 3px);
}

/* Dropdown Section */
.sidebar-nav .dropdown-section .nav-link {
  justify-content: space-between;
}

.sidebar-nav .nav-link-nested {
  padding-left: 2.5rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

.sidebar-nav .nav-link-nested:hover {
  color: #fff;
}

.sidebar-nav .nav-link-nested.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Sidebar Footer */
.sidebar-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 260px;
  padding: 1rem 1.25rem;
  background-color: var(--app-green-900);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 999;
}

.sidebar-user-info {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .btn-light {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Admin Footer */
.admin-footer {
  margin-left: 260px;
  background: #fff;
  border-top: 1px solid #e9eef5;
  color: #6b7a8d;
  font-size: 0.85rem;
  padding: 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-sidebar {
    width: 200px;
  }

  .admin-main {
    margin-left: 200px;
  }

  .admin-footer {
    margin-left: 200px;
  }

  .sidebar-footer {
    width: 200px;
  }
}

@media (max-width: 576px) {
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    min-height: auto;
    padding-bottom: 0;
    box-shadow: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .admin-main {
    margin-left: 0;
    min-height: auto;
  }

  .admin-footer {
    margin-left: 0;
  }

  .sidebar-footer {
    position: relative;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* ── DataTables — Bootstrap 5 theme integration ──────────────────────────── */

/* Spacing inside card containers */
.card .dataTables_wrapper {
  padding: .75rem 1rem .25rem;
}
.card .dataTables_wrapper table.dataTable {
  margin-top: .4rem !important;
  margin-bottom: 0 !important;
}
.card .dataTables_wrapper .dataTables_info,
.card .dataTables_wrapper .dataTables_paginate {
  padding: .5rem 0 .75rem;
}

/* Search input */
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid #dee2e6;
  border-radius: .375rem;
  padding: .3rem .65rem;
  font-size: .875rem;
  transition: border-color .15s, box-shadow .15s;
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--app-green);
  box-shadow: 0 0 0 .2rem rgba(22, 163, 74, .15);
  outline: none;
}

/* Length select */
.dataTables_wrapper .dataTables_length select {
  border: 1px solid #dee2e6;
  border-radius: .375rem;
  padding: .3rem 1.6rem .3rem .6rem;
  font-size: .875rem;
}

/* Info text */
.dataTables_wrapper .dataTables_info {
  font-size: .82rem;
  color: #6c757d;
}

/* Pagination — green active state */
.dataTables_wrapper .dataTables_paginate .page-link {
  color: var(--app-green);
}
.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
  background-color: var(--app-green);
  border-color: var(--app-green);
  color: #fff;
}
.dataTables_wrapper .dataTables_paginate .page-link:hover {
  color: var(--app-green-dark);
  background-color: var(--app-green-light);
  border-color: #dee2e6;
}
.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
  color: #adb5bd;
}

/* Sort icon tinting */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
  opacity: .45;
}
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:after {
  opacity: 1;
  color: var(--app-green);
}

/* Responsive child row toggle icon */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before {
  background-color: var(--app-green) !important;
}

/* Subtle stripe on hover — keep existing table-hover */
table.dataTable.table-hover > tbody > tr:hover > * {
  --bs-table-accent-bg: rgba(22, 163, 74, .04);
}
