/* Sierra Ambulance Modern Prototype CSS */
:root {
    /* Dark Mode (New Default) */
    --primary: #ecf0f1;
    --accent: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --border: #444;

    /* Semantic Backgrounds */
    --bg-main: #121212;
    --bg-card: #1e1e1e;
    --bg-header: #000000;
    --bg-input: #2a2a2a;
    --bg-hover: #2d2d2d;

    /* Semantic Text */
    --text-main: #ecf0f1;
    --text-muted: #bdc3c7;
    --text-inverse: #ffffff;

    /* Timecard Specific */
    --col-worked: rgba(52, 152, 219, 0.12);
    --col-paid: rgba(46, 204, 113, 0.12);

    /* Timecard Alert States */
    --bg-muted: #1a1a1a;
    --bg-warning: #3a2e12;
    --bg-warning-light: #2a220d;
    --border-warning: #b27a1c;
    --text-warning: #f1c40f;

    --bg-success: #1b3d22;
    --bg-success-light: #16301a;
    --border-success: #28a745;
    --text-success: #2ecc71;
}

:root.light-mode {
    /* Light Mode Overrides */
    --primary: #2c3e50;
    --accent: #27ae60;
    --warning: #e67e22;
    --danger: #c0392b;
    --border: #ccc;

    /* Semantic Backgrounds */
    --bg-main: #f0f3f4;
    --bg-card: #ffffff;
    --bg-header: #34495e;
    --bg-input: #ffffff;
    --bg-hover: #f1f5f9;

    /* Semantic Text */
    --text-main: #000000;
    --text-muted: #1a1a1a;
    --text-inverse: #ffffff;

    /* Timecard Specific */
    --col-worked: rgba(52, 152, 219, 0.15);
    --col-paid: rgba(46, 204, 113, 0.15);

    /* Timecard Alert States */
    --bg-muted: #eeeeee;
    --bg-warning: #fef9e7;
    --bg-warning-light: #fff3cd;
    --border-warning: #f1c40f;
    --text-warning: #9c640c;

    --bg-success: #d4edda;
    --bg-success-light: #f4fdf4;
    --border-success: #28a745;
    --text-success: #155724;
}

body {
    font-family: 'Roboto', sans-serif;
    font-size: 11px;
    margin: 0;
    padding: 15px;
    background: var(--bg-main);
    color: var(--text-main);
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Global Header Navigation (ops-header) */
.ops-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
}

/* ── Row 1: Brand + right-side controls ── */
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-row-top {
    min-height: 52px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.brand-title {
    color: white;
    font-size: 1.1rem;
    margin: 0;
    font-family: inherit;
    font-weight: 800;
    white-space: nowrap;
}

.brand-separator {
    color: rgba(255, 255, 255, 0.4);
    margin: 0 6px;
}

.brand-subtitle {
    color: #4fc3f7;
    font-weight: 600;
}

.header-user-info {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7); /* Force light color even in light-mode */
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── Row 2: Nav links ── */
.ops-nav {
    display: flex;
    gap: 4px;
    align-items: center;
    min-height: 36px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    /* hide scrollbar on FF */
}

.ops-nav::-webkit-scrollbar {
    display: none;
    /* hide scrollbar on Chrome */
}

.nav-link {
    color: #b0bec5;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    transition: all 0.2s;
    position: relative;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-link:hover,
.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 8px;
    right: 8px;
    height: 2px;
    background: #4fc3f7;
    border-radius: 2px 2px 0 0;
}

.light-mode .nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
}

.light-mode .nav-link:hover,
.light-mode .nav-link.active {
    color: #fff;
    background: rgba(0, 0, 0, 0.18);
}

.badge-inbox {
    display: none;
    background: #e74c3c;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    margin-left: 4px;
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
    vertical-align: middle;
}

/* ── Right-side controls ── */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.nav-actions-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.admin-link {
    color: #e74c3c;
    font-weight: bold;
    font-size: 0.8rem;
    text-decoration: none;
    letter-spacing: 0.04em;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(231, 76, 60, 0.4);
    transition: all 0.2s;
}

.admin-link:hover {
    background: rgba(231, 76, 60, 0.15);
}

.logout-header-btn {
    background: rgba(192, 57, 43, 0.8);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    transition: background 0.2s;
}

.logout-header-btn:hover {
    background: #c0392b;
}

/* ── Header Utility Bar ── */
.header-utility-bar {
    background: #111;
    border-bottom: 1px solid #2a2a2a;
    padding: 3px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.light-mode .header-utility-bar {
    background: #e1e8eb;
    border-bottom-color: #ccc;
    color: #4a4a4a;
}

/* ── Impersonation ── */
.impersonation-banner {
    background: #f39c12;
    color: #000;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stop-impersonation-btn {
    background: #000;
    color: #fff;
    border: none;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: bold;
}

.stop-impersonation-btn:hover {
    background: #333;
}

.user-clickable {
    cursor: pointer;
    text-decoration: underline dotted;
}

.user-clickable:hover {
    color: var(--accent);
}

/* ── Mobile hamburger ── */
.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 9px;
    border-radius: 4px;
    line-height: 1;
}

/* ── Tablet (≤900px): shrink text, hide subtitle ── */
@media (max-width: 900px) {
    .brand-title {
        font-size: 0.95rem;
    }

    .brand-subtitle {
        display: none;
    }

    .brand-separator {
        display: none;
    }

    .nav-link {
        font-size: 0.75rem;
        padding: 6px 7px;
    }
}

/* ── Mobile (≤768px): hamburger drawer ── */
@media (max-width: 768px) {

    /* Hide utility bar date on mobile to save vertical space */
    .header-utility-bar {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    /* Collapse nav into a full-width dropdown drawer */
    .ops-nav {
        display: none;
        position: absolute;
        /* header-row-top is ~52px, no utility bar on mobile */
        top: 52px;
        left: 0;
        width: 100%;
        background: var(--bg-header);
        flex-direction: column;
        align-items: stretch;
        padding: 8px 0 12px;
        gap: 0;
        border-bottom: 2px solid #0277bd;
        box-sizing: border-box;
        z-index: 1100;
        overflow-x: hidden;
    }

    .ops-nav.mobile-open {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 13px 20px;
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        font-size: 0.85rem;
        font-weight: 600;
        letter-spacing: 0.05em;
    }

    .nav-link.active::after {
        display: none;
    }

    .nav-link.active {
        border-left: 3px solid #4fc3f7;
        padding-left: 17px;
        background: rgba(255, 255, 255, 0.05);
    }

    .header-row-top {
        min-height: 52px;
        border-bottom: none;
    }

    .nav-actions-group {
        gap: 6px;
    }

    .header-user-info {
        display: none;
        /* hide on mobile to reduce clutter */
    }

    .logout-header-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .logout-mobile-btn {
        display: block !important;
        margin-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .admin-link {
        font-size: 0.75rem;
        padding: 3px 6px;
    }
}

/* ── Small phones (≤480px): minimal brand ── */
@media (max-width: 480px) {
    .ops-header {
        padding: 0 12px;
    }

    .brand-title {
        font-size: 0.85rem;
    }

    .nav-actions-group {
        gap: 4px;
    }

    .logout-header-btn {
        display: none;
        /* On very small screens, move logout to drawer */
    }

    /* Show logout at the bottom of the mobile nav drawer instead */
    .ops-nav.mobile-open::after {
        content: '';
        display: block;
        height: 1px;
        background: rgba(255, 255, 255, 0.1);
        margin: 4px 0;
    }
}


/* Grid */
.timecard-grid {
    background: var(--border);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.grid-row {
    display: grid;
    grid-template-columns:
        100px
        /* Date */
        70px
        /* Name */
        70px
        /* Type */
        90px
        /* Diff */
        30px
        /* Early In */
        60px
        /* In */
        60px
        /* Out */
        30px
        /* Holdover */
        40px
        /* Dur */
        45px 45px 45px
        /* W-Buckets */
        45px 45px 45px
        /* P-Buckets */
        30px
        /* Delete */
        1fr;
    /* Comments */
    background: var(--bg-card);
}

.header-row {
    background: var(--bg-header);
    color: var(--text-inverse);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 10px;
    text-align: center;
    height: 25px;
}

/* Row Visual States */
.auto-filled-row {
    background-color: rgba(33, 150, 243, 0.1) !important;
}

.user-edited-row {
    background-color: rgba(255, 235, 59, 0.1) !important;
}

.flagged-row {
    background-color: rgba(230, 126, 34, 0.1) !important;
    border-left: 4px solid var(--warning) !important;
}

.flagged-row:hover {
    background-color: #ffeedb !important;
}

.grid-cell {
    padding: 3px 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.grid-cell input,
.grid-cell select {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 11px;
    padding: 4px;
    text-align: center;
    border-radius: 2px;
}

.grid-cell select {
    text-align: left;
    text-align-last: center;
}

.grid-cell input:focus,
.grid-cell select:focus {
    background: rgba(255, 255, 255, 0.05);
    outline: 1px solid var(--accent);
}

.col-worked {
    background: var(--col-worked) !important;
}

.col-paid {
    background: var(--col-paid) !important;
}

.text-right {
    justify-content: flex-end;
    text-align: right;
}

.sep-right {
    border-right: 2px solid #bdc3c7;
}

/* Holiday Tag */
.holiday-badge {
    background: var(--danger);
    color: white;
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 2px;
    margin-left: 5px;
    font-weight: bold;
}

/* PTO Calculator */
.pto-calc {
    margin-top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    padding: 15px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-stats {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    font-weight: bold;
}

.stat-box {
    background: var(--bg-card);
    padding: 8px 15px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.stat-val {
    color: var(--accent);
}

/* Signed State */
.signed {
    opacity: 0.95;
}

.signed input:not(.nav-actions input),
.signed select:not(.nav-actions select),
.signed button:not(.nav-actions button) {
    pointer-events: none;
    background: #d5d5d5;
    color: #000;
}

/* Error Modal & Overlay */
#errorOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.error-modal {
    margin: 0 auto;
    background: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-top: 6px solid var(--danger);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.error-modal h2 {
    color: var(--danger);
    margin-top: 0;
    font-size: 20px;
}

.error-modal p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 20px 0;
}

.error-modal button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 25px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.error-modal button:hover {
    background: var(--accent);
    filter: brightness(0.9);
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.btn-modal-confirm {
    background: var(--accent) !important;
}

.btn-modal-confirm:hover {
    background: #219150 !important;
}

/* Pretty Buttons */
.btn-primary,
.btn-manage,
.btn-print,
.btn-recalc,
.btn-flag,
.btn-close {
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--sierra-blue, #0288d1);
}

.btn-primary:hover {
    background: #0277bd;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-manage {
    background: #2980b9;
}

.btn-manage:hover {
    background: #2471a3;
    transform: translateY(-1px);
}

.btn-print {
    background: #27ae60;
}

.btn-print:hover {
    background: #229954;
    transform: translateY(-1px);
}

.btn-recalc {
    background: #34495e;
}

.btn-recalc:hover {
    background: #2c3e50;
    transform: translateY(-1px);
}

.btn-flag {
    background: #e67e22;
}

.btn-flag:hover {
    background: #d35400;
    transform: translateY(-1px);
}

.btn-close {
    background: #7f8c8d;
}

.btn-close:hover {
    background: #707b7c;
    transform: translateY(-1px);
}

.btn-modal-cancel {
    background: #7f8c8d !important;
}

.btn-modal-cancel:hover {
    background: #6c7a7d !important;
}

.hidden {
    display: none !important;
}

/* Modal Base Styles */
.modal, .modal-overlay {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal.hidden, .modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background-color: var(--bg-card);
    color: var(--text-main);
    padding: 20px;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.close:hover {
    color: black;
}

.profile-modal h2 {
    margin-top: 0;
    color: var(--text-main);
}

.profile-field {
    margin-bottom: 15px;
}

.profile-field label {
    display: block;
    font-weight: bold;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.profile-field input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-main);
}

.profile-save-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
    margin-top: 10px;
}

.profile-save-btn:hover {
    background: #219150;
}

/* Timecard Mobile Support */
@media (max-width: 768px) {
    .timecard-grid-container {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .timecard-grid {
        min-width: 900px;
    }
}

/* Print View Overrides for Timecard */
@media print {
    standard-header, .nav-actions, .no-print, .btn-print, .btn-recalc, .btn-close, .btn-manage, .btn-flag {
        display: none !important;
    }
    body, html {
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        background: transparent !important;
        zoom: 0.90 !important;
    }
    .top-nav-bar {
        padding: 5px 0 !important;
    }
    .nav-brand {
        font-size: 18px !important;
        font-weight: bold !important;
    }
    .nav-meta {
        font-size: 16px !important;
        font-weight: bold !important;
    }
    .nav-meta span {
        font-size: 16px !important;
    }
    #errorOverlay, .error-modal {
        display: none !important;
    }
    .container {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
    }
    .timecard-grid-container {
        padding: 0 !important;
        margin: 0 !important;
    }
    .week-card {
        margin-bottom: 5px !important;
        padding: 5px !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }
    .footer-stats {
        margin-top: 5px !important;
        page-break-inside: avoid;
    }
    @page { 
        margin: 0.5cm;
    }
    .grid-cell input, .grid-cell select {
        color: black !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    #comments-container textarea {
        color: black !important;
        background: transparent !important;
    }
}