/* ------------------------------------------------------------------
   LMS System -- custom styles layered on top of Bootstrap 5
------------------------------------------------------------------ */
:root {
    --lms-primary: #17406d;
    --lms-primary-dark: #102c4c;
    --lms-accent: #c6a03f;
}

.bg-primary-lms { background-color: var(--lms-primary) !important; }

.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--lms-primary) 0%, var(--lms-primary-dark) 100%);
}

/* --------------------------- branding -------------------------- */
.navbar-logo {
    height: 30px; width: auto; max-width: 50px;
    background: #fff; border-radius: 4px; padding: 2px 4px;
}
.login-logo-plate {
    display: inline-block; background: #fff;
    border-radius: .75rem; padding: 1rem 1.5rem;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .2);
}
.login-logo-plate img { max-height: 84px; max-width: 220px; width: auto; }

/* ---------------------------- cards ---------------------------- */
.card { border: 1px solid #e6eaf0; border-radius: .75rem; }
.card-header { background: #fff; border-bottom: 1px solid #eef1f5; font-weight: 600; }

.stat-card { border-left: 4px solid var(--lms-primary); }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7c93; }

.course-card { transition: transform .12s ease, box-shadow .12s ease; }
.course-card:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(16, 44, 76, .10); }
.course-card.is-expired { opacity: .82; border-left: 4px solid var(--bs-danger); }
.course-card.is-completed { border-left: 4px solid var(--bs-success); }
.course-card.is-active { border-left: 4px solid var(--bs-primary); }

/* ------------------------- lesson list -------------------------- */
.lesson-item { border-radius: .6rem; border: 1px solid #e6eaf0; }
.lesson-item.locked { background: #f7f8fa; color: #9aa5b1; }
.lesson-number {
    width: 38px; height: 38px; flex: 0 0 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-weight: 700; background: #eef2f7; color: var(--lms-primary);
}
.lesson-item.completed .lesson-number { background: var(--bs-success); color: #fff; }
.lesson-item.locked .lesson-number { background: #e4e7eb; color: #9aa5b1; }

/* --------------------------- pdf frame --------------------------- */
/* Only used as the fallback when pdf.js cannot load. */
.pdf-frame {
    width: 100%; height: 78vh; min-height: 480px;
    border: 1px solid #dfe3e8; border-radius: .6rem; background: #525659;
}

/* ------------------------- pdf.js reader ------------------------- */
.pdf-viewer {
    height: 78vh; min-height: 480px; padding: 12px;
    border: 1px solid #dfe3e8; border-radius: .6rem; background: #525659;
    /* y always scrolls so the gutter is reserved before the first render --
       otherwise a late scrollbar would make the fitted page overflow on x. */
    overflow-x: auto; overflow-y: scroll;
}
/* pdf.js is unavailable -- the browser plugin gets the box back untouched. */
.pdf-viewer.is-fallback {
    height: auto; min-height: 0; padding: 0;
    border: 0; background: none; overflow: visible;
}
.pdf-viewer__status {
    padding: 2rem 1rem; text-align: center; color: #dfe3e8; font-size: .9rem;
}
.pdf-page {
    /* max-content + auto margins: centred while it fits, and once a zoomed
       page is wider than the box the margins collapse and it scrolls. */
    width: max-content; margin: 0 auto 12px;
    background: #fff; line-height: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.pdf-page:last-child { margin-bottom: 0; }
.pdf-page canvas { display: block; }

/* ------------------------- test taking --------------------------- */
.test-timer {
    font-variant-numeric: tabular-nums;
    font-size: 1.6rem; font-weight: 700; letter-spacing: .02em;
}
.test-timer.warning { color: var(--bs-warning); }
.test-timer.danger  { color: var(--bs-danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.question-card { scroll-margin-top: 110px; }
.question-card .form-check {
    border: 1px solid #e6eaf0; border-radius: .5rem;
    padding: .65rem .75rem .65rem 2.25rem; margin-bottom: .5rem; cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.question-card .form-check:hover { background: #f6f9fc; border-color: #cbd6e2; }
.question-card .form-check-input:checked ~ .form-check-label { font-weight: 600; }
.question-card .form-check:has(.form-check-input:checked) {
    border-color: var(--lms-primary); background: #eef4fb;
}

.answer-correct { border-color: var(--bs-success) !important; background: #eaf7ef !important; }
.answer-wrong   { border-color: var(--bs-danger) !important;  background: #fdeceb !important; }

.question-nav { position: sticky; top: 1rem; }
.question-nav .btn { width: 40px; margin: 0 .25rem .25rem 0; padding: .2rem 0; font-size: .8rem; }

.sticky-test-bar {
    position: sticky; top: 0; z-index: 1020;
    background: #fff; border: 1px solid #e6eaf0; border-radius: .75rem;
}

/* ------------------------------ misc ----------------------------- */
.progress { background-color: #eef1f5; }
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
@media print { .no-print { display: none !important; } }
