:root {
    --brand-primary: #7F1734;
    --brand-primary-dark: #5c1226;
    --brand-primary-rgb: 127, 23, 52;
    --bs-primary: #7F1734;
    --bs-primary-rgb: 127, 23, 52;
    --bs-link-color: #7F1734;
    --bs-link-hover-color: #5c1226;
    --primary-gradient: linear-gradient(135deg, #5c1226 0%, #7F1734 100%);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

[data-bs-theme="dark"] {
    --bs-primary: #7F1734;
    --bs-primary-rgb: 127, 23, 52;
    --bs-link-color: #e8a0b4;
    --bs-link-hover-color: #fff;
}

.btn-primary {
    --bs-btn-bg: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-bg: var(--brand-primary-dark);
    --bs-btn-hover-border-color: var(--brand-primary-dark);
    --bs-btn-active-bg: var(--brand-primary-dark);
    --bs-btn-active-border-color: var(--brand-primary-dark);
    --bs-btn-disabled-bg: var(--brand-primary);
    --bs-btn-disabled-border-color: var(--brand-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-bg: var(--brand-primary);
    --bs-btn-hover-border-color: var(--brand-primary);
    --bs-btn-active-bg: var(--brand-primary-dark);
    --bs-btn-active-border-color: var(--brand-primary-dark);
}

.navbar.bg-primary {
    background-color: var(--brand-primary) !important;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.main-content {
    flex: 1;
}

/* Hero */
.hero-section {
    background: var(--primary-gradient);
    color: #fff;
    padding: 4.5rem 0 5rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 78% 45%, rgba(255, 255, 255, 0.12) 0%, transparent 55%),
        url('../images/scpe_emblem.png') 82% 50% / min(58%, 520px) no-repeat;
    opacity: 0.14;
    pointer-events: none;
    z-index: 0;
}

.hero-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 40%, rgba(0, 0, 0, 0.08) 100%);
    pointer-events: none;
    z-index: 0;
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-block;
    padding: 0.4rem 0.95rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hero-content .lead {
    font-weight: 500;
    opacity: 0.95;
}

.hero-description {
    max-width: 38rem;
    opacity: 0.92;
    line-height: 1.7;
}

.hero-actions .btn-light {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    font-weight: 600;
}

.hero-actions .btn-outline-light {
    border-width: 2px;
    font-weight: 600;
}

.hero-actions .btn-outline-light:hover {
    color: var(--brand-primary);
}

.hero-logo-showcase {
    position: relative;
    max-width: 440px;
    margin: 0 auto;
    padding: 0.5rem;
}

.hero-logo-showcase::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../images/scpe_emblem.png') center / min(100%, 320px) no-repeat;
    opacity: 0.22;
    filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.15));
    pointer-events: none;
    z-index: 0;
}

.hero-logo-showcase__panel {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 1.85rem 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 28px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.hero-logo-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
}

.hero-logo-frame {
    width: 100%;
    max-width: 158px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hero-logo-showcase__panel:hover .hero-logo-frame {
    transform: translateY(-5px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

.hero-logo {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 118px;
    object-fit: contain;
}

.hero-logo-divider {
    width: 1px;
    align-self: stretch;
    flex-shrink: 0;
    margin: 0.75rem 1.15rem;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.55), transparent);
}

.hero-logo-label {
    display: block;
    margin-top: 0.85rem;
    max-width: 9.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.92;
}

/* Cards */
.card {
    border: none;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border-radius: 12px;
}

.card:hover {
    transform: translateY(-2px);
}

.stat-card {
    border-left: 4px solid var(--brand-primary);
}

.stat-card.success { border-left-color: #198754; }
.stat-card.warning { border-left-color: #ffc107; }
.stat-card.danger { border-left-color: #dc3545; }
.stat-card.info { border-left-color: #0dcaf0; }

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Wizard */
.wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.wizard-progress::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bs-border-color);
    z-index: 0;
}

.wizard-step {
    text-align: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.wizard-step .step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bs-body-bg);
    border: 3px solid var(--bs-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-weight: 600;
    transition: var(--transition);
}

.wizard-step.active .step-circle,
.wizard-step.completed .step-circle {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.wizard-step.completed .step-circle {
    background: #198754;
    border-color: #198754;
}

.wizard-step .step-label {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.wizard-step.active .step-label {
    color: var(--brand-primary);
    font-weight: 600;
}

.wizard-panel {
    display: none;
    animation: fadeIn 0.4s ease;
}

.wizard-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Skills matrix */
.skills-matrix th,
.skills-matrix td {
    text-align: center;
    vertical-align: middle;
}

.skills-matrix input[type="radio"] {
    width: 1.2em;
    height: 1.2em;
    cursor: pointer;
}

/* Dashboard */
.sidebar-card {
    position: sticky;
    top: 80px;
}

.status-timeline .timeline-item {
    padding-left: 1.5rem;
    border-left: 2px solid var(--bs-border-color);
    margin-bottom: 1rem;
    position: relative;
}

.status-timeline .timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--brand-primary);
}

/* Analytics */
.chart-container {
    position: relative;
    height: 300px;
}

.insight-card {
    border-left: 4px solid var(--brand-primary);
    background: var(--bs-tertiary-bg);
}

/* Tables */
.table-responsive {
    border-radius: 12px;
    overflow: hidden;
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

/* Student update modals */
.student-update-modal .modal-content {
    max-height: calc(100vh - 2rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.student-update-modal .student-update-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.student-update-modal .modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.student-update-modal .modal-header,
.student-update-modal .modal-footer {
    flex-shrink: 0;
}

.student-modal-tabs {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.85rem;
    margin-bottom: 1rem;
    background: var(--bs-modal-bg);
    border-bottom: 1px solid var(--bs-border-color);
    scrollbar-width: thin;
}

.student-modal-tabs .nav-link {
    white-space: nowrap;
    font-size: 0.875rem;
    padding: 0.45rem 0.85rem;
}

.student-modal-tab-content {
    padding-top: 0.25rem;
}

.student-modal-section-title {
    color: var(--brand-primary);
    font-weight: 700;
    margin-bottom: 1rem;
}

.student-doc-upload-card {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    background: var(--bs-tertiary-bg);
}

.student-skills-table {
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
}

@media (max-width: 991.98px) {
    .student-update-modal .modal-content {
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Official print documents (letterhead sample layout) */
.print-official-sheet {
    --print-sidebar-width: 1.32in;
    --print-header-height: 1.22in;
    --print-footer-height: 0.85in;
    --print-page-width: 8.5in;
    --print-page-height: 11in;
    width: var(--print-page-width);
    max-width: var(--print-page-width);
    min-height: var(--print-page-height);
    margin: 0 auto;
    background: #fff;
    box-shadow: var(--card-shadow);
    display: grid;
    grid-template-columns: var(--print-sidebar-width) minmax(0, 1fr);
    grid-template-rows: var(--print-header-height) minmax(0, 1fr) var(--print-footer-height);
    grid-template-areas:
        "sidebar header"
        "sidebar body"
        "sidebar footer";
}

.print-lh-sidebar {
    grid-area: sidebar;
    overflow: hidden;
    background: #fff;
}

.print-lh-sidebar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top left;
}

.print-lh-header {
    grid-area: header;
    overflow: hidden;
    background: #fff;
}

.print-lh-header img {
    display: block;
    width: 100%;
    height: var(--print-header-height);
    object-fit: contain;
    object-position: left top;
}

.print-lh-body {
    grid-area: body;
    padding: 0.2in 0.2in 0.15in 0.15in;
    font-size: 0.92rem;
    color: #111;
    background: #fff;
}

.print-lh-footer {
    grid-area: footer;
    overflow: hidden;
    background: #fff;
}

.print-lh-footer img {
    display: block;
    width: 100%;
    height: var(--print-footer-height);
    object-fit: contain;
    object-position: left bottom;
}

.print-document-title h4 {
    color: var(--brand-primary);
    letter-spacing: 0.05em;
    font-size: 1rem;
    text-transform: uppercase;
}

.print-document-title {
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.65rem;
    margin-bottom: 1rem !important;
}

.print-document-footer {
    border-top: 1px solid #eee;
}

.print-official-sheet .table {
    font-size: 0.88rem;
}

.print-official-sheet h5.text-primary {
    font-size: 0.95rem;
    color: #333 !important;
    border-bottom-color: #ccc !important;
}

@media print {
    @page {
        size: letter;
        margin: 1.22in 0 0.85in 1.32in;
    }

    html,
    body,
    body.print-page {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .navbar, .footer, .no-print, #themeToggle {
        display: none !important;
    }

    .container {
        max-width: none !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    .print-official-sheet {
        display: block;
        width: 100%;
        max-width: none;
        min-height: 0;
        margin: 0;
        box-shadow: none !important;
    }

    /* Letterhead on every page — flush to paper edges */
    .print-lh-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 1.32in;
        height: 100%;
        overflow: hidden;
        z-index: 1000;
    }

    .print-lh-sidebar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: top left;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-lh-header {
        position: fixed !important;
        top: 0;
        left: 1.32in;
        right: 0;
        width: auto;
        height: 1.22in;
        overflow: hidden;
        z-index: 1000;
    }

    .print-lh-header img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: left top;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-lh-footer {
        position: fixed !important;
        bottom: 0;
        left: 1.32in;
        right: 0;
        width: auto;
        height: 0.85in;
        overflow: hidden;
        z-index: 1000;
    }

    .print-lh-footer img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: left bottom;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-lh-body {
        padding: 0.12in 0.15in 0.1in 0.1in;
    }

    .print-document-title {
        page-break-inside: avoid;
        page-break-after: avoid;
    }

    .print-lh-body h5 {
        page-break-after: avoid;
    }

    .print-official-sheet .table tr {
        page-break-inside: avoid;
    }

    .bg-body-tertiary,
    .bg-light {
        background: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Auth pages */
.auth-wrapper {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.auth-card {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

/* Word counter */
.word-counter {
    font-size: 0.875rem;
    font-weight: 500;
}

.word-counter.valid { color: #198754; }
.word-counter.invalid { color: #dc3545; }

/* Email verification */
.email-verification-box {
    border-radius: 10px;
}

.verification-code-input {
    max-width: 160px;
    letter-spacing: 0.2em;
    font-weight: 600;
    text-align: center;
}

.email-verified-badge {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

/* Score badge */
.score-badge {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.score-highly { background: #d1e7dd; color: #0f5132; }
.score-qualified { background: #cff4fc; color: #055160; }
.score-review { background: #fff3cd; color: #664d03; }
.score-risk { background: #f8d7da; color: #842029; }

[data-bs-theme="dark"] .score-highly { background: #0f5132; color: #d1e7dd; }
[data-bs-theme="dark"] .score-qualified { background: #055160; color: #cff4fc; }
[data-bs-theme="dark"] .score-review { background: #664d03; color: #fff3cd; }
[data-bs-theme="dark"] .score-risk { background: #842029; color: #f8d7da; }

/* Interview summary print */
@media print {
    .navbar, .no-print, #themeToggle, footer, .d-print-none { display: none !important; }
    .interview-summary-card { border: none !important; box-shadow: none !important; }
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Responsive */
@media (max-width: 991.98px) {
    .hero-section::before {
        background:
            radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.1) 0%, transparent 55%),
            url('../images/scpe_emblem.png') center 115% / min(70%, 360px) no-repeat;
        opacity: 0.12;
    }

    .hero-logo-showcase {
        max-width: 380px;
        margin-top: 0.5rem;
    }

    .hero-logo-frame {
        max-width: 132px;
    }

    .hero-logo {
        max-height: 98px;
    }
}

@media (max-width: 576px) {
    .wizard-step .step-label { display: none; }
    .stat-card .stat-value { font-size: 1.5rem; }
    .hero-section { padding: 2.75rem 0 3.25rem; }

    .hero-logo-showcase__panel {
        flex-direction: column;
        gap: 1.35rem;
        padding: 1.5rem 1.25rem;
    }

    .hero-logo-divider {
        width: 72%;
        height: 1px;
        margin: 0 auto;
        background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.55), transparent);
    }

    .hero-logo-frame {
        max-width: 118px;
    }
}
