/* Crewworld Training & Certifications — office portal theme (navy / teal, Bootstrap 5 base) */
:root {
    --gold-400: #d4a85a;
    --gold-500: #c9994a;
    --navy-900: #061c2a;
    --navy-800: #0a2a3d;
    --navy-700: #0d3a52;
    --teal-600: #0e7c86;
    --teal-500: #13959f;
    --teal-100: #e0f2f3;
    --ink: #17293a;
    --muted: #5d6f80;
    --line: #dfe6ec;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(10, 42, 61, .06), 0 4px 14px rgba(10, 42, 61, .06);
    --bs-primary: #0e7c86;
    --bs-primary-rgb: 14, 124, 134;
    --bs-link-color: #0e7c86;
    --bs-link-color-rgb: 14, 124, 134;
    --bs-link-hover-color: #0a5e66;
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --bs-body-color: #17293a;
    --bs-body-bg: #f4f6f8;
}
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
a { text-decoration: none; }
.text-muted { color: var(--muted) !important; }
.small-caps { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; font-weight: 700; color: var(--muted); }
.min-w-0 { min-width: 0; }

.btn { border-radius: 8px; font-weight: 500; }
.btn-icon { display: inline-flex; align-items: center; gap: .4rem; }
.btn-primary { --bs-btn-bg: var(--teal-600); --bs-btn-border-color: var(--teal-600); --bs-btn-hover-bg: #0b6870; --bs-btn-hover-border-color: #0b6870; --bs-btn-active-bg: #095a61; --bs-btn-disabled-bg: #6aaeb4; --bs-btn-disabled-border-color: #6aaeb4; }
.btn-outline-primary { --bs-btn-color: var(--teal-600); --bs-btn-border-color: var(--teal-600); --bs-btn-hover-bg: var(--teal-600); --bs-btn-hover-border-color: var(--teal-600); --bs-btn-active-bg: var(--teal-600); }
.btn-navy { --bs-btn-color: #fff; --bs-btn-bg: var(--navy-800); --bs-btn-border-color: var(--navy-800); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--navy-700); --bs-btn-hover-border-color: var(--navy-700); }
.form-control, .form-select { border-radius: 8px; border-color: #cfd9e2; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--teal-500); box-shadow: 0 0 0 .2rem rgba(14, 124, 134, .18); }
.form-check-input:checked { background-color: var(--teal-600); border-color: var(--teal-600); }
.form-label { font-weight: 600; font-size: .875rem; color: #2b3d4f; }
.required::after { content: " *"; color: #b42318; }

/* Header */
.app-header { background: linear-gradient(100deg, var(--navy-900), var(--navy-800) 55%, #0b4656); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); border-bottom: 2px solid var(--gold-500); position: sticky; top: 0; z-index: 1030; }
.app-header .navbar-brand { color: #fff; font-weight: 700; display: flex; align-items: center; gap: .6rem; }
.app-header .navbar-brand small { display: block; font-weight: 400; font-size: .68rem; color: var(--gold-400); letter-spacing: .08em; text-transform: uppercase; }
.brand-logo { height: 44px; width: auto; flex: 0 0 auto; filter: drop-shadow(0 0 1px rgba(201, 153, 74, .55)); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--teal-500), #0a5e66); display: grid; place-items: center; color: #fff; font-size: 1.2rem; }
.app-header .nav-link { color: #c9dde3 !important; font-weight: 500; padding: .55rem .85rem !important; border-radius: 8px; display: flex; align-items: center; gap: .4rem; }
.app-header .nav-link:hover, .app-header .nav-link.active, .app-header .nav-link.show { color: #fff !important; background: rgba(255, 255, 255, .09); }
.app-header .dropdown-menu { border: 0; border-radius: 10px; box-shadow: 0 10px 30px rgba(6, 28, 42, .2); padding: .4rem; }
.app-header .dropdown-item { border-radius: 6px; display: flex; align-items: center; gap: .5rem; }
.app-header .navbar-toggler { border-color: rgba(255, 255, 255, .3); }
.app-header .navbar-toggler-icon { filter: invert(1); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--teal-500); color: #fff; font-size: .78rem; font-weight: 700; display: inline-grid; place-items: center; flex: 0 0 auto; }

/* Page */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: 1.75rem 0 1.25rem; }
.page-header h1 { font-size: 1.55rem; font-weight: 700; margin: 0; color: var(--navy-800); }
.page-header .subtitle { color: var(--muted); margin: .25rem 0 0; }
.breadcrumb { font-size: .82rem; margin-bottom: .35rem; }
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: #fff; font-weight: 600; padding: .9rem 1.15rem; border-radius: var(--radius) var(--radius) 0 0 !important; }
.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .85rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: #f8fafb; white-space: nowrap; }
.table > tbody td { vertical-align: middle; font-size: .9rem; }
.table-card { overflow: hidden; }
.page-link { color: var(--teal-600); }
.active > .page-link { background: var(--teal-600); border-color: var(--teal-600); }
.badge-status { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; padding: .35em .65em; border-radius: 6px; }
.footer { color: var(--muted); font-size: .8rem; padding: 1.1rem 0; border-top: 1px solid var(--line); background: #fff; margin-top: 2.5rem; }

/* Dashboard */
.welcome { background: linear-gradient(110deg, var(--navy-800), #0b4656); color: #fff; border-radius: 16px; padding: 1.5rem 1.6rem; margin-top: 1.5rem; position: relative; overflow: hidden; }
.welcome::after { content: "\F4D9"; font-family: "bootstrap-icons"; position: absolute; right: 1.5rem; bottom: -1.8rem; font-size: 7rem; opacity: .07; }
.stat-tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; height: 100%; box-shadow: var(--shadow); display: flex; gap: .9rem; align-items: center; color: var(--ink); transition: border-color .15s; }
a.stat-tile:hover { border-color: var(--teal-500); color: var(--ink); }
.stat-tile .icon { width: 46px; height: 46px; border-radius: 12px; background: var(--teal-100); color: var(--teal-600); display: grid; place-items: center; font-size: 1.35rem; flex: 0 0 auto; }
.stat-tile .value { font-size: 1.6rem; font-weight: 700; color: var(--navy-800); line-height: 1.1; }
.stat-tile .label { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.quick-action { display: flex; flex-direction: column; justify-content: space-between; min-height: 130px; padding: 1.1rem 1.2rem; border-radius: 14px; color: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow); transition: transform .15s; }
.quick-action:hover { transform: translateY(-3px); color: #fff; }
.quick-action i.qa-icon { font-size: 1.7rem; }
.quick-action .qa-title { font-size: 1.05rem; font-weight: 700; line-height: 1.25; }
.quick-action::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.qa-1 { background: linear-gradient(135deg, #0e7c86, #0a5762); }
.qa-2 { background: linear-gradient(135deg, #12507a, #0b3352); }
.qa-3 { background: linear-gradient(135deg, #1d6e5a, #0f4a3c); }
.qa-4 { background: linear-gradient(135deg, #43456e, #26284a); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid #eef2f5; }
.list-row:last-child { border-bottom: 0; }

/* Question sets */
.question-item { border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; background: #fff; margin-bottom: .6rem; }
.q-num { width: 30px; height: 30px; border-radius: 8px; background: var(--navy-800); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .85rem; flex: 0 0 auto; }
.option-line { font-size: .9rem; padding: .12rem 0; display: flex; gap: .45rem; align-items: baseline; }
.option-line.correct { color: #18794e; font-weight: 600; }
.option-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.option-letter { width: 32px; height: 32px; border-radius: 8px; background: #eef3f6; display: grid; place-items: center; font-weight: 700; color: var(--navy-700); flex: 0 0 auto; }
.import-box { border: 2px dashed #b9c9d4; border-radius: 12px; padding: 1.1rem; background: #fafcfd; }
.role-card { border: 2px solid var(--line); border-radius: 10px; padding: .6rem .8rem; cursor: pointer; display: block; height: 100%; }
.btn-check:checked + .role-card { border-color: var(--teal-600); background: var(--teal-100); }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.5rem; color: #b5c4cf; display: block; margin-bottom: .5rem; }
.empty-state h5 { color: var(--ink); font-weight: 600; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-side { background: linear-gradient(150deg, var(--navy-900), var(--navy-700) 60%, #0b5561); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.login-side h1 { font-size: 2.1rem; font-weight: 800; line-height: 1.2; }
.login-point { display: flex; gap: .75rem; margin-bottom: 1rem; color: #cfe3e8; }
.login-point i { font-size: 1.25rem; color: var(--gold-400); }
.login-logo { height: 96px; width: auto; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)); }
.login-form-side { display: grid; place-items: center; padding: 2rem; background: #fff; }
.login-card { width: 100%; max-width: 400px; }
@media (max-width: 991.98px) { .login-wrap { grid-template-columns: 1fr; } .login-side { display: none; } }

.toast-container { z-index: 1090; }
.toast { border: 0; border-radius: 10px; box-shadow: 0 10px 30px rgba(6, 28, 42, .2); color: #fff; }
.toast .toast-body { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.toast-success { background: #0f5f45; }
.toast-error { background: #9f1f16; }
.toast-warning { background: #8a5300; }
.toast-info { background: var(--navy-700); }
#confirmMessage { white-space: pre-line; }
.font-mono { font-family: Consolas, "Courier New", monospace; font-size: .86rem; }
@media print { .app-header, .footer, .no-print { display: none !important; } }

/* ---------------------------------------------------------------- crew portal: test paper & result */
.test-bar { position: sticky; top: 0; z-index: 1020; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: .75rem 1rem; margin: 1rem 0; display: flex; gap: 1rem; justify-content: space-between; align-items: center; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.35rem; color: var(--navy-800); background: var(--teal-100); border-radius: 10px; padding: .3rem .8rem; white-space: nowrap; }
.timer.timer-none { font-size: .95rem; font-weight: 600; }
.timer.warn { background: #fff3cd; color: #8a5a00; }
.timer.danger { background: #f8d7da; color: #a11d2a; }
.question-card { border-left: 4px solid var(--line); }
.question-card.answered { border-left-color: var(--teal-500); }
.q-number { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--navy-800); color: #fff; display: grid; place-items: center; font-size: .8rem; }
.answer-option { display: flex; gap: .7rem; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .5rem; cursor: pointer; transition: border-color .15s, background .15s; }
.answer-option:hover { border-color: var(--teal-500); }
.answer-option:has(input:checked) { border-color: var(--teal-500); background: var(--teal-100); }
.answer-option .form-check-input { margin: 0; flex: 0 0 auto; }
.opt-letter { font-weight: 700; color: var(--teal-600); width: 1.2rem; }
.result-card.is-pass { border-top: 5px solid #198754; }
.result-card.is-fail { border-top: 5px solid #dc3545; }
.result-icon { font-size: 3.5rem; line-height: 1; margin-bottom: .5rem; }
.is-pass .result-icon { color: #198754; }
.is-fail .result-icon { color: #dc3545; }
@media (max-width: 575.98px) { .test-bar { flex-direction: column; align-items: stretch; } .timer { text-align: center; } }

/* Header: keep menu items on one line; tighten spacing on mid-size screens */
.app-header .nav-link { white-space: nowrap; }
@media (min-width: 1200px) and (max-width: 1439.98px) {
    .app-header .navbar-brand { font-size: 1rem; }
    .app-header .nav-link { padding: .5rem .6rem !important; }
}
@media (max-width: 575.98px) { .app-header .navbar-brand { white-space: normal; flex: 1 1 0; min-width: 0; line-height: 1.2; } }
@media (max-width: 399.98px) { .app-header .navbar-brand { font-size: .92rem; } .app-header .navbar-brand small { font-size: .62rem; } }

/* Company logos: shown on a white tile so any logo (white background or not) reads on the navy header */
.company-logo-box { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 10px; padding: 4px 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); flex: 0 0 auto; }
.company-logo-box img { display: block; height: 36px; width: auto; max-width: 140px; object-fit: contain; }
.company-logo-lg { padding: 8px 12px; border-radius: 14px; }
.company-logo-lg img { height: 84px; max-width: 220px; }
.company-banner { display: flex; align-items: center; gap: 1.25rem; }
.company-banner .company-logo-box img { height: 64px; max-width: 200px; }
@media (max-width: 575.98px) { .company-banner { flex-direction: column; align-items: flex-start; } }
.view-as { min-width: 0; max-width: 230px; }

/* Public certificate verification page */
.verify-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: linear-gradient(160deg, #eef3f6, #f9f6ef); }
.verify-card { width: 100%; max-width: 560px; background: #fff; border-radius: 16px; padding: 2rem 1.6rem; box-shadow: 0 10px 30px rgba(10, 42, 61, .12); border-top: 4px solid var(--gold-500); }
.verify-details dt { font-weight: 400; color: #6c7a89; }
.verify-details dd { font-weight: 600; color: var(--navy-800); }
@media (max-width: 575.98px) { .verify-details dd { margin-bottom: .6rem; } }
