/*
 * base.css — Shared CSS for all Sports Betting Stats Platform pages.
 * -------------------------------------------------------------------
 * This file contains design tokens (:root custom properties), global
 * resets, shared utility classes, and common page chrome (glow, footer,
 * empty states, etc.) that every template depends on.
 */

/* =========================================================================
   Design Tokens
   ========================================================================= */
:root {
    --color-bg: #060d0b;
    --color-bg-2: #040a08;
    --color-surface: #0a1512;
    --color-surface-2: #0f1d1a;
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-strong: rgba(255, 255, 255, 0.12);
    --color-foreground: #e8eceb;
    --color-muted: #8a9c96;
    --color-muted-2: #5e716b;
    --color-accent: #22e07a;
    --color-accent-dim: rgba(34, 224, 122, 0.65);
    --color-accent-subtle: rgba(34, 224, 122, 0.15);
    --color-gold: #f59e0b;          /* alias for --color-warn */
    --color-warn: #f59e0b;          /* alias for --color-gold */
    --color-danger: #ef4444;
    --color-brown-surface: #161210;
    --color-brown-surface-2: #1e1914;
    --color-brown-border: rgba(180, 120, 60, 0.14);
    --color-brown-subtle: rgba(180, 120, 60, 0.08);
    --font-geist: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                  Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans",
                  "Helvetica Neue", sans-serif;
}

/* =========================================================================
   Reset & Base
   ========================================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    font-family: var(--font-geist);
    background: var(--color-bg);
    color: var(--color-foreground);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: var(--color-foreground);
}

/* =========================================================================
   Ambient Page Glow
   ========================================================================= */
.page-glow {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: -1;
    background: radial-gradient(
        ellipse at 50% 0%,
        rgba(34, 224, 122, 0.10) 0%,
        rgba(11, 83, 56, 0.25) 30%,
        transparent 65%
    );
}

/* =========================================================================
   Shared Utility / Status Classes
   ========================================================================= */

/* Generic "no data" / disabled text */
.no-data {
    display: block;
    font-size: 0.8rem;
    color: var(--color-muted);
    font-style: italic;
}

/* Loading placeholder */
.loading-text {
    font-size: 0.8rem;
    color: var(--color-muted);
    padding: 6px 0;
}

/* Error message */
.error-text {
    font-size: 0.8rem;
    color: #f87171;
    padding: 6px 0;
}

/* =========================================================================
   Shared Structural Classes
   ========================================================================= */

/* Centered empty-state paragraph (e.g. "No upcoming races") */
.empty-state {
    text-align: center;
    padding: 40px;
    font-size: 0.85rem;
    color: var(--color-muted);
}

/* Smaller centered footer / timestamp line (legacy, kept for static race page) */
.footer-note {
    text-align: center;
    margin-top: 40px;
    font-size: 0.75rem;
    color: var(--color-muted-2);
}

/* =========================================================================
   Site Footer
   ========================================================================= */
.site-footer {
    margin-top: 60px;
    padding: 32px 24px 24px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.footer-disclaimer {
    font-size: 0.78rem;
    color: var(--color-muted);
    max-width: 520px;
    margin: 0 auto 16px;
    line-height: 1.5;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--color-accent-dim);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: color 0.15s;
}

.footer-links a:hover {
    color: var(--color-accent);
}

.footer-sep {
    color: var(--color-muted-2);
    font-size: 0.75rem;
    user-select: none;
}

/* =========================================================================
   Static Pages (Contact, About)
   ========================================================================= */
.static-page-card {
    max-width: 640px;
    margin: 0 auto;
    padding: 40px 24px;
}

.static-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--color-foreground);
}

.static-page-description {
    font-size: 0.9rem;
    color: var(--color-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

.static-page-email {
    margin-top: 8px;
}

.static-page-email a {
    display: inline-block;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-accent);
    text-decoration: none;
    padding: 8px 16px;
    background: var(--color-accent-subtle);
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}

.static-page-email a:hover {
    background: rgba(34, 224, 122, 0.25);
}

/* Section heading (e.g. "Horses (N)" on static race page) */
.section-heading {
    font-size: 1.15rem;
    margin-bottom: 16px;
    color: var(--color-muted);
}

/* Dash placeholder when no analysis exists */
.no-analysis-dash {
    font-size: 0.75rem;
    color: var(--color-muted-2);
}

/* Hint paragraph inside the "no featured" card */
.no-featured-hint {
    margin-top: 6px;
    font-size: 0.8rem;
}

/* "No performance history" message inside JS-generated horse detail */
.perf-empty {
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--color-muted);
}

/* =========================================================================
   Top Navigation Bar (shared across home & static race pages)
   ========================================================================= */

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(10, 21, 18, 0.92);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-nav .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-foreground);
}

.top-nav .brand .logo { font-size: 1.8rem; }

.top-nav .brand .name {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.top-nav .brand .name .accent { color: var(--color-accent); }

.top-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
    list-style: none;
    margin-left: auto;
}

.top-nav .nav-links a {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.15s;
}

.top-nav .nav-links a:hover { color: var(--color-foreground); }

/* Simplified nav – only brand + home link (no auth) */
.top-nav .nav-links .nav-home-link {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.15s;
}

.top-nav .nav-links .nav-home-link:hover { color: var(--color-foreground); }

/* =========================================================================
   Hamburger Menu (mobile)
   ========================================================================= */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    z-index: 200;
    transition: border-color 0.15s;
}

.hamburger:hover {
    border-color: var(--color-accent-dim);
}

.hamburger .bar {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-muted);
    border-radius: 2px;
    transition: all 0.25s;
}

/* Hamburger open state → X */
.hamburger.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav overlay */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
}

.nav-overlay.active {
    display: block;
}

/* Mobile breakpoint */
@media (max-width: 700px) {
    .hamburger {
        display: flex;
        margin-left: auto;
    }

    .top-nav .nav-links {
        position: fixed;
        top: 0;
        right: -280px;
        width: 260px;
        height: 100vh;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 80px 24px 24px;
        background: var(--color-surface);
        border-left: 1px solid var(--color-border);
        z-index: 99;
        transition: right 0.3s ease;
        overflow-y: auto;
        margin-left: 0;
    }

    .top-nav .nav-links.active {
        right: 0;
    }

    .top-nav .nav-links li {
        width: 100%;
        padding: 12px 0;
        border-bottom: 1px solid var(--color-border);
    }

    .top-nav .nav-links li:last-child {
        border-bottom: none;
    }

    .top-nav .nav-links a,
    .top-nav .nav-links .nav-user {
        font-size: 0.95rem;
        display: block;
        width: 100%;
    }

    .nav-auth-btn {
        display: inline-block;
        text-align: center;
    }
}

/* =========================================================================
   Language Switcher
   ========================================================================= */
.lang-switcher {
    position: relative;
    margin-left: 8px;
}

.lang-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-muted);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.lang-switcher-btn:hover {
    border-color: var(--color-accent-dim);
    color: var(--color-foreground);
}

.lang-switcher-btn .lang-flag-img {
    vertical-align: middle;
}

.lang-switcher-btn .lang-arrow {
    font-size: 0.6rem;
    margin-left: 2px;
}

.lang-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    min-width: 170px;
    z-index: 300;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.lang-dropdown.open {
    display: block;
}

.lang-dropdown form {
    display: block;
}

.lang-dropdown button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--color-muted);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, color 0.12s;
}

.lang-dropdown button:hover {
    background: var(--color-surface-2);
    color: var(--color-foreground);
}

.lang-dropdown button.active {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    font-weight: 600;
}

.lang-dropdown button .lang-flag-img {
    vertical-align: middle;
}

/* =========================================================================
   Cookie Consent Banner
   ========================================================================= */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(0);
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.cookie-consent--hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.cookie-consent-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    max-width: 780px;
    margin: 0 auto;
    padding: 16px 24px;
    flex-wrap: wrap;
}

.cookie-consent-text {
    font-size: 0.82rem;
    color: var(--color-muted);
    line-height: 1.5;
    flex: 1 1 300px;
    min-width: 0;
}

.cookie-consent-text a {
    color: var(--color-accent-dim);
    text-decoration: underline;
    font-weight: 500;
}

.cookie-consent-text a:hover {
    color: var(--color-accent);
}

.cookie-consent-btn {
    flex-shrink: 0;
    padding: 8px 20px;
    background: var(--color-accent);
    color: var(--color-bg);
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.cookie-consent-btn:hover {
    background: #2eef88;
    transform: scale(1.02);
}

.cookie-consent-btn:active {
    transform: scale(0.98);
}

@media (max-width: 600px) {
    .cookie-consent-content {
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }

    .cookie-consent-text {
        text-align: center;
        flex: none;
    }
}

/* =========================================================================
   Static Pages: Subtitles and Lists
   ========================================================================= */
.static-page-subheading {
    font-size: 1.25rem;
    margin-top: 2rem;
}

.static-page-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 12px;
    color: var(--color-foreground);
}

.static-page-list {
    list-style: disc;
    padding-left: 20px;
    margin-bottom: 16px;
}

.static-page-list li {
    font-size: 0.88rem;
    color: var(--color-muted);
    line-height: 1.6;
    margin-bottom: 6px;
}

/* =========================================================================
   Info Tooltip (❓ button + popup) — shared across pages
   ========================================================================= */
.hc-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    color: var(--color-muted-2);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    position: relative;
    font-family: inherit;
}

.hc-info-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-muted);
}

.hc-info-popup {
    display: none;
    position: absolute;
    left: 0;
    bottom: calc(100% + 6px);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 10px;
    padding: 10px 14px;
    width: max-content;
    max-width: min(260px, calc(100vw - 40px));
    font-size: 0.78rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.5;
    color: var(--color-foreground);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
    z-index: 200;
    white-space: normal;
}

.hc-info-popup.visible {
    display: block;
}

/* Mobile: adjust switcher position */
@media (max-width: 700px) {
    .lang-switcher {
        margin-left: 0;
        margin-right: 0;
    }

    .lang-dropdown {
        right: -8px;
        min-width: 160px;
    }
}