/* ============================================================
   css/components/exams-dashboard.css
   
   FIXES:
   1. CRITICAL: Removed unscoped `.card { backdrop-filter; background }` rule.
      This was the worst global-pollution bug in the codebase — it forced
      every card on every page to have `background: rgba(255,255,255,0.95)`,
      completely destroying dark mode app-wide. It is now correctly scoped
      to `.exam-card` only.
   2. Removed `@media (prefers-color-scheme: dark)` block. Dark mode is
      handled exclusively by [data-theme="dark"] in variables.css.
   3. Replaced hardcoded shadow and gradient values with CSS tokens.
   4. Replaced hardcoded stat value colors with vars.
   ============================================================ */

/* ── Header ───────────────────────────────────────────────────── */
.exam-header {
    background: var(--gradient-brand);
    border-radius: 0 0 20px 20px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}
.exam-header .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255,255,255,0.6);
}

/* ── Stats cards ──────────────────────────────────────────────── */
.stat-card {
    border-radius: 15px;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl) !important;
}
.stat-card .card-gradient {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    opacity: 0.8;
}
.stat-card .stat-icon {
    width: 50px; height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.1);
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);   /* FIXED: was hardcoded #2d3748 */
    line-height: 1;
}
.stat-card .stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary); /* FIXED: was hardcoded #718096 */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 576px) {
    .stat-card .stat-value     { font-size: 1.5rem; }
    .stat-card .card-body      { padding: 1rem !important; }
}

/* ── Action buttons ───────────────────────────────────────────── */
.btn-action {
    padding: 1.25rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    border-width: 2px;
}
.btn-action:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.btn-action i { transition: transform 0.3s ease; }
.btn-action:hover i { transform: scale(1.1); }

/* ── Exam cards (grid view) ───────────────────────────────────── */
/* FIXED: was `.card { backdrop-filter; background }` — GLOBAL pollution.
   Now correctly scoped to .exam-card only.                        */
.exam-card {
    border-radius: 15px;
    transition: all 0.3s ease;
    overflow: hidden;
    /* Restore card background using the token, not a hardcoded rgba */
    background-color: var(--bg-card);
}
.exam-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl) !important;
}
.exam-card .card-header  { border-radius: 15px 15px 0 0 !important; }
.exam-card .card-footer  { background: rgba(248,249,250,0.5); backdrop-filter: blur(10px); }
.exam-card .exam-meta    { background: rgba(248,249,250,0.8); padding: 0.75rem; border-radius: 8px; }

[data-theme="dark"] .exam-card .card-footer,
[data-theme="dark"] .exam-card .exam-meta {
    background: rgba(30, 41, 59, 0.8);
}

/* ── Filters & search ─────────────────────────────────────────── */
.input-group-text { background: transparent; transition: all 0.3s ease; }

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* ── Table (list view) ────────────────────────────────────────── */
.table-hover tbody tr { transition: all 0.2s ease; }
.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);   /* FIXED: was hardcoded #4a5568 */
    border-bottom: 2px solid var(--border-color);
}

/* ── Badges & buttons ─────────────────────────────────────────── */
.badge { padding: 0.5rem 0.75rem; font-weight: 600; border-radius: 8px; }

.btn-sm { padding: 0.4rem 0.8rem; border-radius: 8px; font-size: 0.85rem; }
.btn-group .btn-sm           { border-radius: 0; }
.btn-group .btn-sm:first-child { border-radius: 8px 0 0 8px; }
.btn-group .btn-sm:last-child  { border-radius: 0 8px 8px 0; }

/* ── Gradient utility ─────────────────────────────────────────── */
.bg-gradient-primary { background: var(--gradient-brand); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 992px) {
    .exam-header h1        { font-size: 1.5rem; }
    .stat-card .stat-value { font-size: 1.75rem; }
}
@media (max-width: 768px) {
    .exam-header   { border-radius: 0 0 15px 15px; }
    .btn-action    { padding: 1rem; font-size: 0.85rem; }
    .btn-action i  { font-size: 1.5rem; }
    .exam-card     { margin-bottom: 1rem; }
    .table-responsive { font-size: 0.85rem; }
    .btn-group     { flex-wrap: wrap; }
    .btn-group .btn-sm { border-radius: 8px; margin: 2px; }
}
@media (max-width: 576px) {
    .exam-header        { padding: 1rem !important; }
    .exam-header h1     { font-size: 1.25rem; }
    .stat-card .card-body { padding: 0.75rem !important; }
    .exam-meta          { font-size: 0.75rem; }
    .card-title         { font-size: 0.95rem; }
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeInExamDash {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.exam-card,
.stat-card { animation: fadeInExamDash 0.5s ease-out; }

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }
.stat-card:nth-child(5) { animation-delay: 0.5s; }

/* ── Custom scrollbar ─────────────────────────────────────────── */
.table-responsive::-webkit-scrollbar        { height: 8px; }
.table-responsive::-webkit-scrollbar-track  { background: var(--bg-body); border-radius: 10px; }
.table-responsive::-webkit-scrollbar-thumb  { background: #667eea; border-radius: 10px; }
.table-responsive::-webkit-scrollbar-thumb:hover { background: #764ba2; }

/* ── SweetAlert2 ──────────────────────────────────────────────── */
.swal2-popup         { border-radius: 15px; }
.swal2-title         { font-size: 1.5rem; font-weight: 700; }
.swal2-html-container{ font-size: 0.95rem; }

/* ── Accessibility ────────────────────────────────────────────── */
.btn:focus,
.form-control:focus,
.form-select:focus { outline: 2px solid #667eea; outline-offset: 2px; }

/* ── Print ────────────────────────────────────────────────────── */
@media print {
    .exam-header, .btn, .btn-group,
    .card-footer, .form-control, .form-select { display: none !important; }
    .card { box-shadow: none !important; border: 1px solid var(--border-color) !important; }
}