/* ============================================================================
   theme.css - Light modernization pass over the default Bootstrap 5 look.
   Loaded AFTER site.css (which vendors in raw Bootstrap source plus a handful
   of old custom rules) and Security_Access8.styles.css, so these rules win the
   cascade without having to hunt through an 11,000+ line vendored file.

   Scope: refine spacing/typography/color/shadows/radius on the existing
   Bootstrap 5 components already used everywhere (cards, buttons, badges,
   tables, forms, nav) - NOT a redesign. Operational color meanings (green
   Check In, amber Check Out, badge colors per visit type) are left alone on
   purpose - staff scan these by color at the gate, changing them would hurt
   more than the visual refresh helps.

   Mobile/tablet-first: gate staff are assumed to be on a phone or tablet as
   often as a desktop, so touch target sizing and table readability on narrow
   screens get real weight here, not just desktop polish.
   ============================================================================ */

:root {
    /* Core palette - a deeper, more confident blue than Bootstrap's stock
       #0d6efd, paired with a cool neutral gray page background instead of
       stark white so cards/tables have visual separation without needing a
       border on every single one. */
    --sga-navy: #10243D;
    --sga-primary: #1B4B73;
    --sga-primary-hover: #163C5C;
    --sga-primary-soft: #E8F0F7;
    --sga-accent: #0E9384;
    --sga-bg: #F3F5F8;
    --sga-surface: #FFFFFF;
    --sga-text: #1F2937;
    --sga-text-muted: #64748B;
    --sga-border: #E2E8F0;
    --sga-border-strong: #CBD5E1;
    --sga-radius-sm: 8px;
    --sga-radius: 12px;
    --sga-radius-lg: 16px;
    --sga-shadow-sm: 0 1px 2px rgba(16, 36, 61, 0.06), 0 1px 3px rgba(16, 36, 61, 0.06);
    --sga-shadow: 0 2px 8px rgba(16, 36, 61, 0.08), 0 1px 3px rgba(16, 36, 61, 0.06);
    --sga-shadow-md: 0 8px 24px rgba(16, 36, 61, 0.10);
    /* Minimum comfortable touch target per WCAG/Apple/Material guidance. */
    --sga-touch-target: 44px;
}

/* FIX: site.css defines its own --bs-primary/--bs-primary-rgb at :root as a teal (#0d98ba) -
   that's what every Bootstrap utility class built on the CSS variable (.bg-primary, .text-primary,
   .border-primary) actually reads, completely separately from the .btn-primary/.btn-outline-primary
   overrides below (those are older, fully hardcoded-hex Bootstrap component CSS, not variable-based
   - see the comment on those rules). Without this, .btn-primary buttons would show the new navy
   while .bg-primary cards/badges (Reports dashboard stat cards, Visitor balance cards) kept showing
   the old teal - two different "primary" colors on the same page. Overriding the variable here
   makes every var-based Bootstrap component pick up the new navy automatically, on top of (not
   instead of) the hardcoded-component overrides further down. */
:root {
    --bs-primary: #1B4B73;
    --bs-primary-rgb: 27, 75, 115;
}

/* ----------------------------------------------------------------------------
   Base / typography
   -------------------------------------------------------------------------- */
body {
    background-color: var(--sga-bg);
    color: var(--sga-text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--sga-navy);
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* FIX: a heading inside a dark/colored section (e.g. the marketing home page's
   bg-dark "Let's Get In Touch!" section) normally gets its white color only by
   INHERITING it from the ancestor's .text-white/.bg-dark/.bg-primary class -
   it has no .text-white of its own. Inheritance is the weakest way to get a
   value in CSS, so the plain `h2 { color: ... }` rule above was winning over
   it, turning the heading near-invisible (dark navy text on a near-black
   background). This resets color back to `inherit` specifically for headings
   inside any of these known colored containers, so they fall back to
   whatever the container itself specifies (white, in all current cases)
   instead of the navy default. Any heading that already carries its own
   explicit text-white class (most of them, e.g. the masthead h1) was never
   affected - a class selector always beats a plain element selector
   regardless of source order, so this is only a safety net for the ones that
   don't. */
.text-white h1, .text-white h2, .text-white h3, .text-white h4, .text-white h5, .text-white h6,
.text-white .h1, .text-white .h2, .text-white .h3, .text-white .h4, .text-white .h5, .text-white .h6,
.bg-dark h1, .bg-dark h2, .bg-dark h3, .bg-dark h4, .bg-dark h5, .bg-dark h6,
.bg-dark .h1, .bg-dark .h2, .bg-dark .h3, .bg-dark .h4, .bg-dark .h5, .bg-dark .h6,
.bg-primary h1, .bg-primary h2, .bg-primary h3, .bg-primary h4, .bg-primary h5, .bg-primary h6,
.bg-primary .h1, .bg-primary .h2, .bg-primary .h3, .bg-primary .h4, .bg-primary .h5, .bg-primary .h6,
.bg-success h1, .bg-success h2, .bg-success h3, .bg-success h4, .bg-success h5, .bg-success h6,
.bg-success .h1, .bg-success .h2, .bg-success .h3, .bg-success .h4, .bg-success .h5, .bg-success .h6,
.bg-danger h1, .bg-danger h2, .bg-danger h3, .bg-danger h4, .bg-danger h5, .bg-danger h6,
.bg-danger .h1, .bg-danger .h2, .bg-danger .h3, .bg-danger .h4, .bg-danger .h5, .bg-danger .h6,
.bg-secondary h1, .bg-secondary h2, .bg-secondary h3, .bg-secondary h4, .bg-secondary h5, .bg-secondary h6,
.bg-secondary .h1, .bg-secondary .h2, .bg-secondary .h3, .bg-secondary .h4, .bg-secondary .h5, .bg-secondary .h6,
/* Bootstrap's own colored buttons (.btn-primary etc.) set white text via their own component
   rule, not a .text-white utility class someone would remember to add - the stat-card-btn
   pattern on the Reports dashboard IS a <button class="... text-white bg-primary ...">, which
   the .text-white/.bg-primary selectors above already cover, but this covers the .btn-* variant
   too in case a future card uses that pattern without also adding .text-white/.bg-primary. */
.btn-primary .h1, .btn-primary .h2, .btn-primary .h3, .btn-primary .h4, .btn-primary .h5, .btn-primary .h6,
.btn-danger .h1, .btn-danger .h2, .btn-danger .h3, .btn-danger .h4, .btn-danger .h5, .btn-danger .h6,
.btn-success .h1, .btn-success .h2, .btn-success .h3, .btn-success .h4, .btn-success .h5, .btn-success .h6,
.btn-dark .h1, .btn-dark .h2, .btn-dark .h3, .btn-dark .h4, .btn-dark .h5, .btn-dark .h6 {
    color: inherit;
}

/* The overwhelming majority of pages open with `<h1>Page Title</h1>` (or
   `.h3`) immediately followed by an `<hr />` - styling that pattern once here
   gives every single page a consistent, tidier header instead of touching
   each view individually. */
main h1:first-child,
main .h3:first-child,
main > div > h1:first-of-type {
    margin-bottom: 0.35rem;
}

main hr {
    border: none;
    border-top: 1px solid var(--sga-border);
    margin: 0.75rem 0 1.5rem;
}

a {
    color: var(--sga-primary);
}

    a:hover {
        color: var(--sga-primary-hover);
    }

/* ----------------------------------------------------------------------------
   Layout shell
   -------------------------------------------------------------------------- */
main[role="main"] {
    padding-top: 0.5rem;
}

/* Give pages that use container-fluid (most of the staff/admin screens) the
   same breathing room on mobile that .container already gets, instead of
   content running edge-to-edge on a phone. */
.container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* ----------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--sga-shadow-sm) !important;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.navbar-brand img {
    max-height: 42px;
    width: auto !important;
}

.navbar-nav .nav-link {
    font-weight: 600;
    color: var(--sga-text);
    padding: 0.5rem 0.9rem;
    border-radius: var(--sga-radius-sm);
    transition: background-color 0.15s ease, color 0.15s ease;
}

    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link:focus {
        background-color: var(--sga-primary-soft);
        color: var(--sga-primary);
    }

    .navbar-nav .nav-link.dropdown-toggle::after {
        margin-left: 0.4em;
        vertical-align: 0.2em;
    }

.dropdown-menu {
    border: 1px solid var(--sga-border);
    border-radius: var(--sga-radius);
    box-shadow: var(--sga-shadow-md);
    padding: 0.4rem;
    margin-top: 0.4rem;
}

.dropdown-item {
    border-radius: var(--sga-radius-sm);
    padding: 0.55rem 0.9rem;
    font-weight: 500;
}

    .dropdown-item:hover,
    .dropdown-item:focus {
        background-color: var(--sga-primary-soft);
        color: var(--sga-primary);
    }

/* Bigger, easier-to-hit menu items once the nav collapses into the mobile
   hamburger - a 32px-tall dropdown row is a fine desktop mouse target but a
   frustrating one to tap accurately on a phone. */
@media (max-width: 575.98px) {
    .navbar-collapse {
        padding-top: 0.5rem;
    }

    .dropdown-menu {
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0 0 0 0.5rem;
    }

    .dropdown-item {
        padding: 0.7rem 0.9rem;
    }
}

/* ----------------------------------------------------------------------------
   Cards - the dominant container for forms and detail views across the app
   -------------------------------------------------------------------------- */
.card {
    border: 1px solid var(--sga-border);
    border-radius: var(--sga-radius);
    box-shadow: var(--sga-shadow-sm);
}

.card.shadow-sm {
    box-shadow: var(--sga-shadow) !important;
}

.card-body {
    padding: 1.25rem;
}

/* ----------------------------------------------------------------------------
   Buttons - keep Bootstrap's semantic colors (success/warning/danger etc.)
   exactly as-is; refine shape, weight, and touch sizing only.
   -------------------------------------------------------------------------- */
.btn {
    border-radius: var(--sga-radius-sm);
    font-weight: 600;
    padding: 0.5rem 1rem;
    min-height: var(--sga-touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: transform 0.05s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

    .btn:active {
        transform: translateY(1px);
    }

.btn-sm {
    min-height: 36px;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8125rem;
}

.btn-primary {
    background-color: var(--sga-primary);
    border-color: var(--sga-primary);
}

    .btn-primary:hover, .btn-primary:focus {
        background-color: var(--sga-primary-hover);
        border-color: var(--sga-primary-hover);
    }

.btn-outline-primary {
    color: var(--sga-primary);
    border-color: var(--sga-primary);
}

    .btn-outline-primary:hover {
        background-color: var(--sga-primary);
        border-color: var(--sga-primary);
    }

.btn:hover {
    filter: brightness(1.03);
}

/* Row-action buttons in DataTables (Edit/Options/Pass/Check In/Check Out) are
   the buttons staff tap most often, in the smallest space - a touch of extra
   padding here matters more than almost anywhere else in the app. */
.table .btn, td .btn {
    min-height: 38px;
    padding: 0.4rem 0.75rem;
}

/* ----------------------------------------------------------------------------
   Badges - visit-type / status labels used throughout Visitor and Daily Log
   pages. Colors are untouched (see file header); shape/weight only.
   -------------------------------------------------------------------------- */
.badge {
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 0.42em 0.7em;
    border-radius: 6px;
}

/* ----------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-label {
    font-weight: 600;
    color: var(--sga-text);
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.form-control, .form-select {
    border: 1px solid var(--sga-border-strong);
    border-radius: var(--sga-radius-sm);
    padding: 0.55rem 0.8rem;
    /* 16px minimum - anything smaller makes iOS Safari auto-zoom the page on
       focus, which is disorienting on a phone at the gate. */
    font-size: 1rem;
    min-height: var(--sga-touch-target);
}

.form-control:focus, .form-select:focus {
    border-color: var(--sga-primary);
    box-shadow: 0 0 0 0.2rem rgba(27, 75, 115, 0.15);
}

/* Read-only detail summaries (dl/dt/dd pattern used on Check In/Check Out and
   several detail pages) - give the label column a lighter weight than the
   value so the actual data reads first. */
dl.row dt {
    color: var(--sga-text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

dl.row dd {
    font-size: 1rem;
    font-weight: 500;
}

/* ----------------------------------------------------------------------------
   Tables (plain Bootstrap tables, not DataTables-specific chrome below)
   -------------------------------------------------------------------------- */
.table {
    --bs-table-border-color: var(--sga-border);
}

    .table thead th {
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.04em;
        color: var(--sga-text-muted);
        border-bottom-width: 2px;
        background-color: var(--sga-bg);
    }

    .table td, .table th {
        vertical-align: middle;
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
    }

.table-hover > tbody > tr:hover > * {
    background-color: var(--sga-primary-soft);
}

/* ----------------------------------------------------------------------------
   DataTables chrome (search box, length select, pagination, info text) - used
   on nearly every list page in the app (My Visitor List, Daily Log, Audit
   Log, Email Logs, Reports, Manage Bookings, etc.). Several pages still load
   the Bootstrap 4 DataTables integration CSS directly in the view (loaded
   after this stylesheet in the DOM - see DailyLog.cshtml's own comment on
   why), so a few rules here need !important to reliably win regardless of
   which bootstrap3/4/5 DataTables CSS a given page happens to load.
   -------------------------------------------------------------------------- */
.dataTables_wrapper {
    padding-top: 0.25rem;
}

.dataTables_filter input,
.dataTables_length select {
    border: 1px solid var(--sga-border-strong) !important;
    border-radius: var(--sga-radius-sm) !important;
    padding: 0.4rem 0.7rem !important;
    min-height: 40px;
}

.dataTables_filter input:focus {
    outline: none;
    border-color: var(--sga-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(27, 75, 115, 0.15);
}

table.dataTable thead th {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--sga-text-muted) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--sga-radius-sm) !important;
    margin: 0 2px;
    min-width: 38px;
    min-height: 38px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent !important;
}

    .dataTables_wrapper .dataTables_paginate .paginate_button.current,
    .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
        background: var(--sga-primary) !important;
        border-color: var(--sga-primary) !important;
        color: #fff !important;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
        background: var(--sga-primary-soft) !important;
        border-color: var(--sga-primary-soft) !important;
        color: var(--sga-primary) !important;
    }

.dataTables_wrapper .dataTables_info {
    color: var(--sga-text-muted);
    font-size: 0.85rem;
}

/* Search/filter row inputs typed into DataTables' footer filter inputs
   (used on Visitor List, Daily Log, Audit Log, etc. via the tfoot-input
   pattern) - same touch-friendly treatment as the main search box above. */
tfoot input[type="text"] {
    border: 1px solid var(--sga-border-strong);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    min-height: 34px;
}

/* ----------------------------------------------------------------------------
   Mobile-specific table readability
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .table td, .table th {
        padding-top: 0.55rem;
        padding-bottom: 0.55rem;
        font-size: 0.9rem;
    }

    .card-body {
        padding: 1rem;
    }
}

/* ----------------------------------------------------------------------------
   Alerts - soften the default Bootstrap alert look slightly to match the
   card/badge radius used everywhere else.
   -------------------------------------------------------------------------- */
.alert {
    border-radius: var(--sga-radius-sm);
    border: 1px solid transparent;
}

/* ----------------------------------------------------------------------------
   Visit-type badge legend (Views/Shared/_VisitTypeLegend.cshtml) - a plain
   <details>/<summary> disclosure, styled so the closed "Type color legend"
   trigger reads as a small tappable link rather than a bare bullet marker.
   -------------------------------------------------------------------------- */
.visit-type-legend > summary {
    cursor: pointer;
    color: var(--sga-primary);
    font-size: 0.85rem;
    font-weight: 600;
    list-style: none;
}
.visit-type-legend > summary::-webkit-details-marker {
    display: none;
}
.visit-type-legend > summary::before {
    content: "\25B8";
    display: inline-block;
    margin-right: 0.35rem;
    transition: transform 0.15s ease;
}
.visit-type-legend[open] > summary::before {
    transform: rotate(90deg);
}
.visit-type-legend > summary:hover {
    color: var(--sga-primary-hover);
}

/* ----------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer.bg-light {
    background-color: var(--sga-surface) !important;
    border-top: 1px solid var(--sga-border);
}
