/* ==========================================================================
   shared.css — El Diablos Hockey Club, v2 frontend
   Tokens + base styles carried over verbatim from the legacy index.html
   :root variables (see El_Diablos_Brand_Guide.docx, Section 1.1 — "Website
   Theme"). Do not introduce new colors here without updating the brand
   guide; this file is the single source of truth for every v2 page.
   ========================================================================== */

:root {
    --bg-page: #f6dca7;       /* Page Cream */
    --panel-bg: #f6dca7;
    --creamsicle: #df7a32;    /* Creamsicle Orange — "Vintage Athletic Jersey Orange" */
    --cyan-accent: #1f7d8c;   /* Cyan Accent — darker turquoise accent text */
    --text-light: #1e3840;
    --text-dark: #1e3840;     /* Navy/Charcoal Text */
    --border-panel: #27b1c3;  /* Team Turquoise — panel borders, table headers */
    --nav-stripe: #125763;    /* Deep Ocean Blue — nav bar / header stripe */

    /* New tokens needed for v2 (not in legacy index.html), derived from
       existing values rather than invented from scratch: */
    --panel-shadow: rgba(18, 87, 99, 0.15);
    --row-hover: rgba(39, 177, 195, 0.08);
    --border-soft: rgba(39, 177, 195, 0.2);
    --danger: #c0392b;        /* OUT / error state — not in brand guide, flagged for Vic's confirmation */
    --success: #2f9e44;       /* IN / confirmed state — not in brand guide, flagged for Vic's confirmation */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-page);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-dark);
    min-height: 100vh;
    padding-bottom: 60px;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

a { color: inherit; }

/* --------------------------------------------------------------------------
   Header block (logo + title)
   -------------------------------------------------------------------------- */
#site-header-root {
    position: sticky;
    top: 0;
    z-index: 200;
}
.header-wrapper {
    background-color: var(--border-panel);
    padding: 14px 0;
    text-align: center;
}
header.site-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
.logo-shield {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.club-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 2px rgba(18, 56, 64, 0.7)) drop-shadow(0 0 5px rgba(18, 56, 64, 0.45));
}
.header-titles { display: flex; flex-direction: column; align-items: center; }
.header-titles h1 {
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 2px 2px 0px var(--nav-stripe);
}
.header-titles p {
    color: var(--nav-stripe);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.75rem;
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Nav stripe: links (left) + auth control (right)
   New layout vs. legacy index.html, which only had centered nav links with
   no auth control. Per wireframe: HOME / ROSTER / CALENDAR links, auth
   control right-aligned.
   -------------------------------------------------------------------------- */
.nav-stripe {
    background-color: var(--nav-stripe);
    padding: 12px 0;
}
.nav-stripe .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.nav-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    list-style: none;
}
.nav-links a {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--creamsicle);
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.5px;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
    color: #ffffff;
    text-decoration: underline;
}

/* --- Hamburger toggle: hidden on desktop, shown below 768px --- */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    order: -1;
}

@media (max-width: 768px) {
    .nav-toggle { display: inline-flex; }

    .nav-stripe .container { flex-wrap: wrap; }

    .nav-links {
        order: 10;
        flex-basis: 100%;
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.2s ease;
    }
    .nav-links.is-open {
        max-height: 320px;
        margin-top: 12px;
    }
    .nav-links a {
        display: block;
        width: 100%;
        padding: 14px 4px;
        font-size: 1.1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-links { transition: none; }
}

/* --- Auth control: logged-out state --- */
.auth-control { position: relative; }
.btn-login {
    background-color: var(--creamsicle);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.btn-login:hover { background-color: #c8682a; }

/* --- Auth control: logged-in state (player or captain) --- */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: transparent;
    border: 2px solid var(--creamsicle);
    border-radius: 24px;
    padding: 6px 14px 6px 6px;
    cursor: pointer;
    color: #ffffff;
    font-weight: 700;
}
.user-chip .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--creamsicle);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 900;
    overflow: hidden;
}
.user-chip .avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip .chevron { font-size: 0.7rem; transition: transform 0.15s ease; }
.user-chip[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--panel-bg);
    border: 3px solid var(--border-panel);
    border-radius: 10px;
    box-shadow: 0 6px 0px var(--panel-shadow);
    min-width: 180px;
    overflow: hidden;
    z-index: 50;
}
.user-menu[hidden] { display: none; }
.user-menu a, .user-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    cursor: pointer;
    border-bottom: 1px solid var(--border-soft);
}
.user-menu a:last-child, .user-menu button:last-child { border-bottom: none; }
.user-menu a:hover, .user-menu button:hover { background-color: var(--row-hover); }
.user-menu .menu-item-admin { color: var(--cyan-accent); }
.user-menu .menu-item-logout { color: var(--danger); }

/* --------------------------------------------------------------------------
   Panels, tables — carried over from legacy index.html
   -------------------------------------------------------------------------- */
.panel {
    background-color: var(--panel-bg);
    border-radius: 12px;
    border: 4px solid var(--border-panel);
    box-shadow: 0 6px 0px var(--panel-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.panel-header {
    background-color: rgba(39, 177, 195, 0.1);
    padding: 16px 24px;
    border-bottom: 3px solid var(--border-panel);
    text-align: center;
}
.panel-header h2 {
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dark);
}
.panel-body { padding: 24px; flex-grow: 1; color: var(--text-light); text-align: center; }

.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 1.15rem; }
th {
    color: var(--cyan-accent);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.95rem;
    letter-spacing: 1px;
    padding: 16px 24px;
    border-bottom: 3px solid var(--border-panel);
    text-align: center;
}
th:first-child, td:first-child { text-align: left; }
td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-light);
    font-weight: 500;
    text-align: center;
}
tbody tr:hover { background-color: var(--row-hover); }
.loading { padding: 40px; text-align: center; color: var(--cyan-accent); font-style: italic; }

/* --------------------------------------------------------------------------
   Page layout helper (vertical stack used on Home, reusable elsewhere)
   -------------------------------------------------------------------------- */
.page-stack {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 40px auto;
    max-width: 1000px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .header-titles h1 { font-size: 1.5rem; }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .user-chip .chevron { transition: none; }
}
