/* assets/css/public.css — Stylesheet dùng chung cho các trang public */

/* ── Biến màu ───────────────────────────────────────────── */
:root {
    --brand: #1A3A6E;
    --brand-dark: #1A3A6E;
    --brand-hover: #12284c;
    --bg: #f7f9fc;
}

/* ── Reset / Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: #333;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: clamp(0.8125rem, 0.75rem + 0.25vw, 0.9375rem); /* 13px → 15px */
}
.page-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

/* ── Header ─────────────────────────────────────────────── */
.site-header {
    background-color: var(--brand);
    border-bottom: 3px solid #e6b800;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-brand { transition: opacity .2s; }
.header-brand:hover { opacity: .85; }
.header-nav-link { opacity: .9; transition: opacity .2s; }
.header-nav-link:hover, .header-nav-link:focus-visible { opacity: 1; }

/* Focus States */
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    box-shadow: none;
}

/* ── Auth Card ──────────────────────────────────────────── */
.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0,0,0,.07);
}
.auth-title { color: var(--brand); letter-spacing: -.5px; }
.btn-brand  { background-color: var(--brand); color: #fff; border: none; border-radius: 4px; font-weight: 500; transition: background .2s; }
.btn-brand:hover, .btn-brand:focus { background-color: var(--brand-hover); color: #fff; }
.form-control { border-radius: 4px; border: 1px solid #cbd5e1; padding: .6rem .75rem; }
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(26,58,110,.15); }
.form-label { font-size: clamp(0.8rem, 0.75rem + 0.2vw, 0.9rem); color: #475569; margin-bottom: .3rem; }
.text-brand { color: var(--brand) !important; }
.bg-brand { background-color: var(--brand) !important; }
.border-brand { border-color: var(--brand) !important; border-width: 1px; border-style: solid; }
.border-start.border-brand { border-left-color: var(--brand) !important; }
.btn-outline-brand { color: var(--brand); border-color: var(--brand); background-color: transparent; }
.btn-outline-brand:hover { color: #fff; background-color: var(--brand); border-color: var(--brand); }

/* ── Component Enhancements ─────────────────────────────── */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 8px; /* Slightly rounder for modern feel */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03); /* form placeholder elements or aria-label support */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}
.stat-card { 
    border: none; 
    border-radius: 8px; 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); 
    border-left: 4px solid var(--brand); 
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }

/* Touch Targets & Inputs (Mobile First) */
.btn, .form-control, .form-select {
    min-height: 44px; /* Fitts' Law: larger touch targets */
    border-radius: 6px;
}
select.form-select { cursor: pointer; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Centralized Sidebar & Layout (Admin & Candidate) ── */
.sidebar { 
    background-color: var(--sidebar-bg, #1A3A6E); 
    height: calc(100vh - 61px); /* Header is typically ~61px */
    position: sticky; 
    top: 61px; /* Below the header */
    left: 0; 
    width: 16.666667%; /* col-md-2 equivalent */
    z-index: 900; /* Less than header, more than content */
    overflow-y: auto;
}
.sidebar-menu a { 
    color: #cbd5e1; 
    text-decoration: none; 
    padding: 12px 20px; 
    display: block; 
    font-weight: 500; 
    transition: background-color 0.2s ease, color 0.2s ease;
}
.sidebar-menu a:hover, .sidebar-menu a.active { 
    background-color: rgba(255,255,255,0.1); 
    color: #fff; 
}

.main-content { 
    margin-left: 0; 
    padding: 30px; 
    width: 83.333333%; /* col-md-10 */
    min-height: calc(100vh - 71px); /* Adjust based on header/footer */
}

/* Mobile Offcanvas — dark theme to match desktop sidebar */
.offcanvas.sidebar-mobile {
    background-color: var(--sidebar-bg, #1A3A6E) !important;
    color: #cbd5e1 !important;
}
.offcanvas.sidebar-mobile .offcanvas-header {
    background-color: rgba(0,0,0,0.15);
}
.offcanvas.sidebar-mobile .sidebar-menu a {
    color: #cbd5e1;
}

/* Mobile Off-Canvas Sidebar Styling */
@media (max-width: 767.98px) {
    .sidebar { display: none !important; }
    .sidebar.open {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        padding-top: 20px;
        box-shadow: 4px 0 20px rgba(0,0,0,.3);
        transform: translateX(0);
        animation: slideIn .25s ease-out;
    }
    @keyframes slideIn {
        from { transform: translateX(-100%); }
        to   { transform: translateX(0); }
    }
    .sidebar.open #closeSidebarBtn { display: inline-block !important; }

    .sidebar-mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 1040;
    }
    .sidebar-mobile-overlay.show { display: block; }

    .main-content { margin-left: 0; width: 100%; padding: 15px; }

    /* Optimize data tables on mobile */
    .table-responsive {
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        background: #fff;
    }

    /* ── Mobile Compact: Typography ── */
    h1, .h1 { font-size: 1.4rem; }
    h2, .h2 { font-size: 1.2rem; }
    h3, .h3 { font-size: 1.1rem; }
    h4, .h4 { font-size: 1rem; }
    h5, .h5, h6, .h6 { font-size: .9rem; }
    p, li, td, th { font-size: .84rem; }

    /* ── Mobile Compact: Spacing ── */
    .page-wrapper { padding: 20px 10px; }
    .auth-card { padding: 24px 20px; }
    .card { margin-bottom: 12px; }
    .card-header { padding: 10px 12px; }
    .card-body { padding: 12px; }
    .alert { padding: 10px 12px; font-size: .85rem; }
    .alert h5 { font-size: .95rem; }
    .mb-4 { margin-bottom: 1rem !important; }
    .mb-3 { margin-bottom: .75rem !important; }
    .py-3 { padding-top: .5rem !important; padding-bottom: .5rem !important; }
    .pb-3 { padding-bottom: .5rem !important; }
    .gap-3 { gap: .5rem !important; }
    .gap-4 { gap: .75rem !important; }

    /* ── Mobile Compact: Forms ── */
    .form-control, .form-select { min-height: 38px; font-size: .85rem; padding: .4rem .6rem; }
    .form-label { font-size: .8rem; margin-bottom: .2rem; }
    .btn { min-height: 38px; font-size: .85rem; padding: .4rem .75rem; }
    .btn-sm { min-height: 30px; font-size: .78rem; padding: .25rem .5rem; }

    /* ── Mobile Compact: Header ── */
    .site-header .container-fluid { padding-left: 8px !important; padding-right: 8px !important; }
    .site-header .py-2 { padding-top: .35rem !important; padding-bottom: .35rem !important; }

    /* ── Mobile Compact: Footer ── */
    .site-footer { font-size: .8rem; }
    .site-footer .py-4 { padding-top: .75rem !important; padding-bottom: .75rem !important; }
    .footer-bottom { padding: 8px 0; font-size: .75rem; }
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
    background-color: var(--brand-dark);
    border-top: 3px solid #e6b800;
    margin-top: auto;
}
.footer-heading {
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,.1);
    padding-bottom: 8px;
}
.footer-social {
    color: rgba(255,255,255,.5);
    font-size: 1.15rem;
    text-decoration: none;
    transition: color .2s;
}
.footer-social:hover { color: #e6b800; }
.footer-bottom {
    background-color: rgba(0,0,0,.2);
    padding: 12px 0;
}
