/* Elite Driver Training - shares FleetPortal's design system exactly (same :root tokens,
   .card/.badge/.btn/.auth-* components copied from FleetPortal/Content/Site.css) so this site
   reads as the same product family, not a reskin. Sections below FleetPortal's own components
   are this site's own additions (video list, player, test questions) built in the same
   visual language rather than FleetPortal originals. */

:root {
    --ink: #14161a;
    --sidebar-bg: #14161a;
    --sidebar-text: #cfd3d8;
    --accent: #e8a33d;
    --accent-dark: #c8842a;
    --bg: #f4f5f7;
    --card-bg: #ffffff;
    --border: #e6e8eb;
    --text: #1c1f24;
    --text-muted: #6b7280;
    --green: #1f9d55;
    --blue: #3b82f6;
    --purple: #8b5cf6;
    --red: #e0403e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { text-decoration: none; color: inherit; }

/* ---- Topbar (this site has no persistent sidebar nav -- driver pages are a mostly linear
   flow, not a multi-section admin console -- so the brand mark lives in the topbar itself
   instead of a separate sidebar like FleetPortal's manager-facing shell) ---- */
.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left { display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    height: 36px;
    width: auto;
    display: block;
}
.brand-name { font-weight: 600; color: var(--text); font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--text-muted); }

.topbar-nav { display: flex; align-items: center; gap: 4px; }
.topbar-nav-link {
    padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text-muted);
}
.topbar-nav-link:hover { background: var(--bg); color: var(--text); }
.topbar-nav-link.active { background: var(--ink); color: #fff; }

.account-chip { display: flex; align-items: center; gap: 12px; }
.account-chip-text { text-align: right; }
.account-chip-name { font-size: 13px; font-weight: 600; }
.account-chip-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--ink); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}

.page-container { max-width: 1000px; margin: 0 auto; padding: 28px 20px; }

/* ---- Cards, badges, buttons, form fields -- copied from FleetPortal/Content/Site.css ---- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.card-title { font-size: 12px; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; margin-bottom: 6px; }
.card-heading { font-size: 18px; font-weight: 700; margin: 0 0 4px; }

.page-header-row { display: flex; justify-content: space-between; align-items: flex-start; }

.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.badge.certified { background: #e6f7ec; color: var(--green); }
.badge.progress { background: #e8f0fe; color: var(--blue); }
.badge.awaiting { background: #f0edfc; color: var(--purple); }
.badge.expired { background: #fdecec; color: var(--red); }
.badge.pending { background: #f3f4f6; color: #6b7280; }
.badge.needs-renewal { background: #fdf3e3; color: var(--accent-dark); }

.btn { -webkit-appearance: none; appearance: none; display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text); }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-outline { background: #fff; color: var(--text); }
.btn-link { background: none; border: none; color: var(--accent-dark); font-weight: 700; padding: 0; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.text-input {
    width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px;
}
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--text-muted); }
.field-note { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: #d1d5db; border-radius: 999px; transition: .15s; }
.toggle-slider:before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(18px); }

/* ---- Auth pages (Login/SelectFleet) -- identical pattern to FleetPortal's own
   Account/Login.aspx (.auth-shell/.auth-card/etc.), so signing in feels like the same product
   even though drivers and fleet managers land on completely different sites. ---- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); padding: 20px; }
.auth-card { background: #fff; border-radius: 14px; padding: 36px; width: 100%; max-width: 380px; }
.auth-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; }
.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; }
.auth-error { background: #fdecec; color: #7a1f1e; border: 1px solid #f6c9c8; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.auth-submit { width: 100%; background: var(--ink); color: #fff; border: none; border-radius: 8px; padding: 12px; font-weight: 700; cursor: pointer; margin-top: 6px; }
.auth-footer { text-align: center; font-size: 13px; margin-top: 16px; color: var(--text-muted); }

.fleet-picker-option { display: block; width: 100%; margin-bottom: 10px; text-align: left; }

/* ---- My Courses ---- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.course-card { display: flex; flex-direction: column; }
.course-thumbnail {
    width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
    border-radius: 8px; margin: -20px -20px 14px; width: calc(100% + 40px);
}
.course-thumbnail-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: var(--ink); color: var(--accent); font-size: 32px; font-weight: 700;
}
.course-card-title { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.course-card-description { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.course-card-detail { font-size: 13px; color: var(--text-muted); margin: 10px 0; }

/* ---- Watch page: video list + player -- this site's own addition, same tokens/radii as
   the rest rather than a FleetPortal original (FleetPortal has no video/course-content UI). ---- */
.watch-layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }

.video-list-title { font-weight: 700; margin-bottom: 12px; }
.chapter-group { margin-bottom: 14px; }
.chapter-title { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }

.video-list-item { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 8px; font-size: 13px; color: var(--text); text-decoration: none; }
a.video-list-item:hover { background: var(--bg); }
.video-list-item.current { background: #fdf3e3; font-weight: 600; }
.video-list-item.locked { color: #9ca3af; cursor: not-allowed; }
.video-check { display: inline-block; width: 16px; color: var(--green); font-weight: 700; }
.go-to-test { display: block; text-align: center; margin-top: 16px; }

.player-wrapper { margin: 12px 0; }
#video-container {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--ink);
    border-radius: 8px;
    overflow: hidden;
}
.player-stub {
    background: var(--ink);
    color: #9ca3af;
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.player-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; }
.autoplay-toggle { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.nav-buttons { display: flex; justify-content: space-between; gap: 12px; }

/* ---- Certifications ---- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cert-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.resend-success { background: #e6f7ec; color: var(--green); border-color: #c9ecd6; }
.resend-error { background: #fdecec; color: #7a1f1e; border-color: #f6c9c8; }

/* ---- Test page ---- */
.test-result { max-width: 480px; margin: 40px auto; text-align: center; }
.score-line { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.test-question { margin-bottom: 14px; }
.question-text { font-weight: 600; margin-bottom: 10px; }
.test-option { display: block; padding: 6px 0; font-size: 14px; }
.test-progress { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

@media (max-width: 720px) {
    .watch-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .topbar { flex-wrap: wrap; gap: 10px; row-gap: 8px; }
    .topbar-left { flex-wrap: wrap; gap: 10px; }
    .brand-sub { display: none; }
    .topbar-nav { gap: 2px; }
    .topbar-nav-link { padding: 6px 8px; font-size: 13px; }
}

@media (max-width: 480px) {
    .auth-card { margin: 24px auto; padding: 24px; border-radius: 0; }
    .topbar { padding: 12px 16px; }
    .account-chip-text { display: none; }
}
