/* GST FastAPI + HTMX Template Styles
   ================================== 
   Hardcoded GST branding colors throughout
*/

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #ffffff;
    color: #3f3f46; /* zinc-700 */
    line-height: 1.6;
}

/* ============================================================================
   HEADER - GST Branding
   ============================================================================ */
#header {
    background-image: url('/static/images/redline.png');
    background-repeat: repeat-x;
    display: flex;
    position: relative;
    font-style: italic;
    align-items: center;
    height: 71px;
}

#header img {
    float: left;
}

#logoSection {
    background-image: url('/static/images/shadow.png');
    display: flex;
    align-items: center;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1.1px;
    line-height: 70px;
    text-transform: uppercase;
    color: #000000;
    padding-right: 10px;
}

#welcome {
    margin-left: auto;
    width: fit-content;
    height: auto;
    align-self: center;
    padding-left: 5px;
    padding-right: 5px;
    background-image: url('/static/images/shadow.png');
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000000;
}

#welcome i {
    margin-right: 5px;
}

/* ============================================================================
   LAYOUT
   ============================================================================ */
.main-row {
    display: flex;
    min-height: calc(100vh - 120px);
}

.column-side-nav {
    width: 200px;
    background-color: #fafafa; /* zinc-50 */
    border-right: 1px solid #e4e4e7; /* zinc-200 */
}

.column-main {
    flex: 1;
    padding: 20px;
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */
.side-nav {
    padding: 15px 0;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin: 2px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #52525b; /* zinc-600 */
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover {
    background-color: #fee2e2; /* red-100 */
    color: #d71921; /* GST Red */
}

.nav-link i {
    width: 20px;
    margin-right: 10px;
}

.nav-divider {
    height: 1px;
    background-color: #e4e4e7;
    margin: 10px 15px;
}

/* ============================================================================
   CARDS
   ============================================================================ */
.card {
    background-color: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: #fafafa;
    padding: 15px 20px;
    border-bottom: 1px solid #e4e4e7;
    font-weight: 600;
    color: #d71921; /* GST Red */
}

.card-header i {
    margin-right: 8px;
}

.card-body {
    padding: 20px;
}

.card-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.card-body li {
    margin: 8px 0;
}

.card-body li i {
    color: #16a34a; /* green-600 */
    margin-right: 8px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
    margin-right: 10px;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background-color: #d71921; /* GST Red */
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #b81419;
}

.btn-secondary {
    background-color: #52525b; /* zinc-600 */
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #3f3f46;
}

.btn-lg {
    padding: 15px 25px;
    font-size: 18px;
}

/* ============================================================================
   COUNTER DEMO
   ============================================================================ */
.counter-container {
    display: flex;
    justify-content: center;
    padding: 30px;
}

.counter-container form {
    display: flex;
    align-items: center;
    gap: 20px;
}

.counter-value {
    font-size: 48px;
    font-weight: bold;
    color: #d71921;
    min-width: 100px;
    text-align: center;
}

/* ============================================================================
   CODE BLOCKS
   ============================================================================ */
pre {
    background-color: #27272a; /* zinc-800 */
    color: #fafafa;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 15px 0;
}

code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
}

p code {
    background-color: #f4f4f5;
    padding: 2px 6px;
    border-radius: 4px;
    color: #d71921;
}

/* ============================================================================
   FOOTER
   ============================================================================ */
footer {
    text-align: center;
    padding: 20px;
    background-color: #fafafa;
    border-top: 1px solid #e4e4e7;
    font-size: 12px;
    color: #71717a;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */
.text-nowrap { white-space: nowrap; }
h1, h2, h3 { color: #18181b; margin-bottom: 15px; }
h1 i, h2 i, h3 i { color: #d71921; margin-right: 10px; }
p { margin-bottom: 15px; }

/* ============================================================================
   NAV SECTION LABEL
   ============================================================================ */
.nav-section-label {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #a1a1aa;
}

/* ============================================================================
   TABLES
   ============================================================================ */
.table-wrapper { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background-color: #f4f4f5;
    color: #3f3f46;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid #e4e4e7;
    white-space: nowrap;
}
.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.data-table tbody tr:hover { background-color: #fafafa; }

/* ============================================================================
   BADGES / STATUS PILLS
   ============================================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-approved { background: #dcfce7; color: #15803d; }
.badge-pending  { background: #fef9c3; color: #a16207; }
.badge-rejected { background: #fee2e2; color: #b91c1c; }

/* venue color pills */
.badge-texans  { background: #002b5e; color: #fff; }
.badge-rockets { background: #ce1141; color: #fff; }
.badge-astros  { background: #002d62; color: #fff; }
.badge-fc      { background: #f7d000; color: #002b5e; }
.badge-rangers { background: #003087; color: #fff; }
.badge-tmf     { background: #6d28d9; color: #fff; }
.badge-venue   { background: #e4e4e7; color: #3f3f46; }

/* ============================================================================
   FORMS
   ============================================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 700; color: #18181b; }
.form-control {
    padding: 8px 12px;
    border: 1px solid #d4d4d8;
    border-radius: 6px;
    font-size: 14px;
    color: #18181b;
    background: #fff;
    width: 100%;
}
.form-control:focus { outline: none; border-color: #d71921; box-shadow: 0 0 0 2px rgba(215,25,33,.15); }

/* ============================================================================
   STAT CARDS (DASHBOARD)
   ============================================================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.stat-number { font-size: 36px; font-weight: 700; color: #d71921; line-height: 1; }
.stat-label  { font-size: 12px; color: #71717a; text-transform: uppercase; letter-spacing: .5px; margin-top: 6px; }

/* ============================================================================
   FILTER BAR
   ============================================================================ */
.filter-bar {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #fafafa;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
}
.filter-bar .form-group label { font-size: 11px; font-weight: 700; color: #71717a; text-transform: uppercase; letter-spacing: .4px; }
.filter-bar select { min-width: 140px; }

/* ============================================================================
   TOGGLE FORM PANEL
   ============================================================================ */
.form-panel {
    background: #fafafa;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    display: none;
}
.form-panel.open { display: block; }

/* ============================================================================
   DASHBOARD GRID (home page) — 2 cards side-by-side, stacks under 900px
   ============================================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   FORM ROWS (home page) — 2-col field grid, stacks under 640px
   ============================================================================ */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
    margin-bottom: 20px;
}

/* Guest fields — 3-col layout for name / title / email, stacks under 640px */
.guest-row {
    display: grid;
    grid-template-columns: 3fr 2fr 3fr;
    gap: 8px;
    margin-bottom: 8px;
}
.guest-row-header {
    gap: 6px;
    margin-bottom: 6px;
    padding: 0 2px;
}

@media (max-width: 640px) {
    .form-row-2 {
        grid-template-columns: 1fr;
    }
    .guest-row {
        grid-template-columns: 1fr;
    }
    /* Column-header labels stop making sense once fields stack; the input
       placeholders + aria-labels carry the meaning. */
    .guest-row-header {
        display: none;
    }
}

/* ============================================================================
   GAME DAY SELECTOR — Venue / Date / Opponent row, stacks under 900px
   ============================================================================ */
.gameday-selector {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px 20px;
    align-items: start;
}
@media (max-width: 900px) {
    .gameday-selector {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   GAME DAY SUMMARY REPORT — header bar, 4-col info grid, attendee tables
   ============================================================================ */
@media (max-width: 900px) {
    /* Header bar: tighten padding so it doesn't dominate at narrow widths. */
    .gd-report-header {
        padding: 14px 16px !important;
        gap: 12px !important;
    }
    /* Info strip: 4 cols -> 2 cols. Re-do the right borders so the inner cells
       have separators on the 2-col layout instead of the 4-col one. */
    .gd-info-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    .gd-info-grid > div {
        border-right: none !important;
        border-bottom: 1px solid #e5e7eb;
    }
    .gd-info-grid > div:nth-child(odd) {
        border-right: 1px solid #e5e7eb !important;
    }
    .gd-info-grid > div:nth-last-child(-n+2) {
        border-bottom: none;
    }
}

@media (max-width: 640px) {
    /* Info strip: 2 cols -> single column. */
    .gd-info-grid {
        grid-template-columns: 1fr !important;
    }
    .gd-info-grid > div {
        border-right: none !important;
        border-bottom: 1px solid #e5e7eb;
    }
    .gd-info-grid > div:last-child {
        border-bottom: none;
    }

    /* Attendee table stacks into cards. The shared .data-table-stack rules
       already handle the layout — these overrides release the inline
       nowrap+ellipsis on Requestor/Company so long names wrap in card mode. */
    .gd-attendee-table td {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        text-align: left !important;
    }
    .gd-attendee-table colgroup { display: none; }
}

/* ============================================================================
   TRACKER PAGE — filter bar wraps cleanly under 900px
   ============================================================================ */
@media (max-width: 900px) {
    .tracker-filter-bar .form-group {
        flex: 1 1 140px !important;
        min-width: 140px !important;
    }
}

/* ============================================================================
   ADMIN TOOLBAR (tracker) — flex row, wraps on narrow widths
   ============================================================================ */
.admin-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    flex-wrap: wrap;
}
.admin-toolbar-spacer { flex: 1; }

@media (max-width: 640px) {
    .admin-toolbar-spacer { display: none; }
    .admin-toolbar .btn {
        flex: 1 1 100%;
        justify-content: center;
        margin-right: 0;
    }
}

/* ============================================================================
   DATA TABLE — stack into cards at <= 640px (each row becomes a card)
   ============================================================================ */
@media (max-width: 640px) {
    .data-table-stack,
    .data-table-stack tbody,
    .data-table-stack tr,
    .data-table-stack td {
        display: block;
        width: 100% !important;
        max-width: none !important;
    }
    .data-table-stack { table-layout: auto !important; }
    .data-table-stack thead { display: none; }
    .data-table-stack tr {
        margin-bottom: 12px;
        padding: 8px 14px;
        border: 1px solid #e4e4e7;
        border-radius: 8px;
        background: #ffffff;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }
    .data-table-stack tbody tr:hover { background: #ffffff; }
    .data-table-stack td {
        padding: 7px 0 !important;
        border-bottom: 1px solid #f4f4f5 !important;
        text-align: left !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
    .data-table-stack td:last-child { border-bottom: none !important; }
    .data-table-stack td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 700;
        color: #71717a;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        margin-bottom: 3px;
    }
    /* Venue badge has inline max-width:100px + ellipsis — release in card mode */
    .data-table-stack .badge {
        white-space: normal !important;
        max-width: none !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
    /* Empty state row — no pseudo label, centered message */
    .data-table-stack td[colspan]::before { content: none; }
    .data-table-stack td[colspan] { text-align: center !important; }
}

/* ============================================================================
   EDIT MODAL (tracker) — details grid + guest field rows
   ============================================================================ */
.modal-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    margin-bottom: 18px;
    background: #fafafa;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    padding: 14px;
}
.modal-guest-card {
    background: #f9fafb;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}
.modal-guest-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

@media (max-width: 640px) {
    .modal-details-grid { grid-template-columns: 1fr; }
    .modal-guest-fields { grid-template-columns: 1fr; }
}

/* ============================================================================
   SKIP LINK (accessibility)
   ============================================================================ */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: #d71921;
    color: #ffffff;
    padding: 10px 14px;
    z-index: 200;
    text-decoration: none;
    font-weight: 600;
}
.skip-link:focus {
    left: 0;
}

/* ============================================================================
   MOBILE NAV TOGGLE (hamburger) + BACKDROP
   ============================================================================ */
.nav-toggle {
    display: none; /* hidden on desktop; revealed in @media below */
    background-image: url('/static/images/shadow.png');
    background-color: transparent;
    border: 0;
    color: #000000;
    font-size: 20px;
    line-height: 1;
    padding: 0 16px;
    height: 100%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.nav-toggle:focus-visible {
    outline: 2px solid #d71921;
    outline-offset: -2px;
}

.nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 90;
}
.nav-backdrop[hidden] {
    display: none;
}

/* ============================================================================
   RESPONSIVE — collapse sidebar into off-canvas drawer at <= 900px
   ============================================================================ */
@media (max-width: 900px) {
    .nav-toggle {
        display: inline-flex;
    }

    /* Header: hide the long non-wrapping title text and welcome message so they
       can't push the body wider than the viewport. Logo image stays for brand. */
    .header-title-text { display: none; }
    #welcome { display: none; }

    .main-row {
        display: block;
        width: 100%;
        min-height: calc(100vh - 120px);
    }

    .column-side-nav {
        position: fixed;
        top: 71px; /* header height */
        left: 0;
        bottom: 0;
        width: 240px;
        max-width: 80vw;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        overflow-y: auto;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    }
    .column-side-nav.is-open {
        transform: translateX(0);
    }

    /* Clear the desktop `flex: 1` shorthand (which carries flex-basis: 0%) so
       the <main> reliably fills the now-block .main-row at narrow widths. */
    .column-main {
        flex: none;
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 16px;
    }

    body.nav-open {
        overflow: hidden;
    }
}

