/* ==========================================================================
   Crocolympics Athlete Portal — Theme & Design System
   Palette: Vibrant Flame Theme (Red -> Orange -> Yellow Gradient)
   ========================================================================== */

:root {
    /* Background base (Dark mode default) */
    --bg-deep: #120606;
    --bg-panel: #1e0b09;
    --bg-panel-2: #2a0f0b;
    --bg-panel-3: #38150e;

    /* Signature Crocolympic Gradient Colors */
    --croc-red: #ff3b30;
    --croc-orange: #ff7e1d;
    --croc-yellow: #ffcc00;
    --croc-gradient: linear-gradient(135deg, #ff3b30 0%, #ff7e1d 50%, #ffcc00 100%);
    --croc-gradient-btn: linear-gradient(135deg, #ff3b30, #ff7e1d);
    
    --ink: #fff5f0;
    --ink-dim: #d4b4a8;
    --ink-faint: #967569;

    --border: rgba(255, 126, 29, 0.22);
    --border-strong: rgba(255, 126, 29, 0.55);
    --glow: rgba(255, 126, 29, 0.4);

    --radius: 16px;
    --radius-sm: 10px;

    --font-display: "Bebas Neue", "Oswald", Impact, sans-serif;
    --font-body: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
}

/* Light Mode Overrides */
[data-theme="light"] {
    --bg-deep: #fbf7f5;
    --bg-panel: #ffffff;
    --bg-panel-2: #f4eae4;
    --bg-panel-3: #e8dcd4;

    --ink: #2b110b;
    --ink-dim: #6e463a;
    --ink-faint: #9c7165;

    --border: rgba(255, 126, 29, 0.25);
    --border-strong: rgba(255, 126, 29, 0.6);
}

[data-theme="light"] .glass {
    background: #ffffff !important;
    box-shadow: 0 10px 30px -10px rgba(255, 126, 29, 0.15) !important;
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="email"],
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: #fbf7f5 !important;
    color: #2b110b !important;
}

[data-theme="light"] select option {
    background: #ffffff !important;
    color: #2b110b !important;
}

[data-theme="light"] body {
    background-image:
        radial-gradient(ellipse 900px 500px at 15% -10%, rgba(255, 59, 48, 0.08), transparent 65%),
        radial-gradient(ellipse 800px 500px at 110% 10%, rgba(255, 126, 29, 0.08), transparent 65%);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-deep);
    color: var(--ink);
    font-family: var(--font-body);
    min-height: 100vh;
}

body {
    background-image:
        radial-gradient(ellipse 900px 500px at 15% -10%, rgba(255, 59, 48, 0.15), transparent 65%),
        radial-gradient(ellipse 800px 500px at 110% 10%, rgba(255, 126, 29, 0.12), transparent 65%),
        radial-gradient(ellipse 600px 400px at 50% 100%, rgba(255, 204, 0, 0.08), transparent 60%);
    background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: 0.03em; margin: 0 0 0.4em; font-weight: 400; }
p { line-height: 1.55; color: var(--ink-dim); }

::selection { background: var(--croc-orange); color: #000; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--bg-panel-3); border-radius: 10px; }

/* Glass panels */
.glass {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
}

/* ---------------------------------------------------------------------- */
/* Login page                                                             */
/* ---------------------------------------------------------------------- */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 24px;
}

.login-shell::before,
.login-shell::after {
    content: "";
    position: absolute;
    left: 0; right: 0;
    height: 180px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0 60px,
        rgba(255, 126, 29, 0.06) 60px 62px
    );
    opacity: 0.6;
    animation: flame-drift 22s linear infinite;
}
.login-shell::before { top: -60px; }
.login-shell::after { bottom: -60px; animation-direction: reverse; }

@keyframes flame-drift {
    from { transform: translateX(0); }
    to { transform: translateX(-240px); }
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 42px 38px 36px;
    position: relative;
    z-index: 2;
    text-align: center;
}

.brand-mark {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    border-radius: 16px;
    background: var(--croc-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 25px rgba(255, 126, 29, 0.4);
}
.brand-mark svg { width: 32px; height: 32px; }

.login-card h1 {
    font-size: 38px;
    color: var(--ink);
    line-height: 1;
}
.login-card .eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.22em;
    background: var(--croc-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: block;
    font-weight: 700;
}
.login-card .sub {
    font-size: 14.5px;
    margin-bottom: 24px;
}

/* ---------------------------------------------------------------------- */
/* Form Controls (Inputs, Selects, Textareas, Buttons)                    */
/* ---------------------------------------------------------------------- */

.field {
    text-align: left;
    margin-bottom: 18px;
}
.field label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-dim);
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}
/* Universal form element styling reset */
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 13px 16px;
    background: rgba(18, 6, 6, 0.7) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--ink) !important;
    font-family: var(--font-body) !important;
    font-size: 14.5px !important;
    outline: none !important;
    box-shadow: none !important;
    transition: all 0.2s ease;
}

select {
    cursor: pointer;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ff7e1d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    padding-right: 40px !important;
}

select option {
    background: #1e0b09 !important;
    color: #fff5f0 !important;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--croc-orange) !important;
    box-shadow: 0 0 0 3px rgba(255, 126, 29, 0.25) !important;
    background: rgba(30, 11, 9, 0.9) !important;
}

.btn-primary {
    width: 100%;
    padding: 14px 22px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--croc-gradient);
    color: #0d0302;
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 0.05em;
    cursor: pointer;
    margin-top: 8px;
    box-shadow: 0 10px 25px -5px rgba(255, 59, 48, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -5px rgba(255, 126, 29, 0.5);
    filter: brightness(1.08);
}
.btn-primary:active {
    transform: translateY(0);
}

.form-error {
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.4);
    color: #ff6b63;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 18px;
    text-align: left;
}

.notice-box {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.notice-box.green {
    background: rgba(255, 204, 0, 0.12);
    border: 1px solid rgba(255, 204, 0, 0.35);
    color: var(--croc-yellow);
}

.roster-hint {
    margin-top: 22px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-faint);
    letter-spacing: 0.05em;
}

/* ---------------------------------------------------------------------- */
/* Loading overlay                                                         */
/* ---------------------------------------------------------------------- */

#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(18, 6, 6, 0.94);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loading-overlay.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.launch-track svg {
    width: 260px;
    height: auto;
}
#loading-overlay .status {
    font-family: var(--font-display);
    font-size: 28px;
    letter-spacing: 0.1em;
    background: var(--croc-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

/* ---------------------------------------------------------------------- */
/* App Layout Shell & Sidebar                                            */
/* ---------------------------------------------------------------------- */

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.brand-text {
    font-family: var(--font-display);
    font-size: 22px;
    line-height: 1;
    color: var(--ink);
    letter-spacing: 0.05em;
}
.brand-text small {
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--croc-orange);
    margin-top: 3px;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    color: var(--ink-dim);
    font-weight: 600;
    font-size: 14.5px;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}
.nav-link svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
    transition: transform 0.15s ease;
}
.nav-link:hover {
    color: var(--ink);
    background: rgba(255, 126, 29, 0.08);
}
.nav-link:hover svg {
    transform: translateX(2px);
}
.nav-link.active {
    color: #000;
    background: var(--croc-gradient);
    border-left-color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 20px -5px rgba(255, 126, 29, 0.4);
}

.sidebar-footer {
    padding-top: 18px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.player-chip {
    display: flex;
    align-items: center;
    gap: 12px;
}
.player-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--croc-gradient);
    color: #000;
    font-family: var(--font-display);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.player-meta .p-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--ink);
}
.player-meta .p-role {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--croc-orange);
    text-transform: uppercase;
}

.logout-link {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-faint);
    transition: color 0.15s ease;
}
.logout-link:hover {
    color: var(--croc-red);
}

/* ---------------------------------------------------------------------- */
/* Main Content Area & Cards                                             */
/* ---------------------------------------------------------------------- */

.main {
    padding: 36px 40px 60px;
    max-width: 1200px;
}

.page-head {
    margin-bottom: 30px;
}
.page-head .eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--croc-orange);
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
}
.page-head h1 {
    font-size: 44px;
    line-height: 1;
    margin: 0 0 8px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 24px;
}
.stat-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-dim);
    margin-bottom: 10px;
}
.stat-value {
    font-family: var(--font-display);
    font-size: 46px;
    line-height: 1;
    margin-bottom: 6px;
    color: var(--ink);
}
.stat-value.green {
    background: var(--croc-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat-value.gold {
    color: var(--croc-yellow);
}
.stat-note {
    font-size: 13px;
    color: var(--ink-faint);
}

.section-card {
    padding: 28px;
    margin-bottom: 28px;
}
.card-eyebrow {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.15em;
    color: var(--croc-orange);
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
}
.section-card h2 {
    font-size: 26px;
    margin-bottom: 20px;
}

/* ---------------------------------------------------------------------- */
/* Lists, Rows & Badges                                                  */
/* ---------------------------------------------------------------------- */

.data-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}
.data-row:hover {
    border-color: var(--border-strong);
    background: rgba(255, 126, 29, 0.05);
    transform: translateY(-1px);
}

.match-when {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-faint);
    min-width: 110px;
}
.match-teams {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
}
.match-vs {
    color: var(--croc-orange);
    font-family: var(--font-mono);
    font-size: 11px;
}
.highlight {
    color: var(--croc-yellow);
}

.tag {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 100px;
    border: 1px solid var(--border-strong);
    color: var(--croc-orange);
    font-weight: 600;
}
.tag.water {
    color: var(--croc-yellow);
    border-color: rgba(255, 204, 0, 0.4);
}
.tag.pending {
    color: var(--ink-faint);
    border-color: var(--border);
}

.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.filter-btn {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(18, 6, 6, 0.5);
    color: var(--ink-dim);
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.filter-btn:hover {
    border-color: var(--croc-orange);
    color: var(--ink);
}
.filter-btn.active {
    background: var(--croc-gradient);
    color: #000;
    border-color: transparent;
    font-weight: 700;
}

/* ---------------------------------------------------------------------- */
/* Head to Head Component                                                */
/* ---------------------------------------------------------------------- */

.h2h-selector {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
    padding: 24px;
    margin-bottom: 24px;
}
.h2h-player label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-dim);
    display: block;
    margin-bottom: 8px;
}
.h2h-player select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(18, 6, 6, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    outline: none;
}
.h2h-vs {
    font-family: var(--font-display);
    font-size: 26px;
    color: var(--croc-orange);
}

.h2h-scoreboard {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
    padding: 36px 28px;
    text-align: center;
    margin-bottom: 28px;
}
.h2h-name {
    font-family: var(--font-display);
    font-size: 32px;
    color: var(--ink);
    margin-bottom: 8px;
}
.h2h-score {
    font-family: var(--font-display);
    font-size: 56px;
    line-height: 1;
    color: var(--croc-yellow);
}
.h2h-label {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-faint);
    text-transform: uppercase;
    margin-top: 4px;
}
.h2h-divider {
    width: 1px;
    height: 80px;
    background: var(--border);
}

/* ---------------------------------------------------------------------- */
/* Reports Grid                                                          */
/* ---------------------------------------------------------------------- */

.reports-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--ink-faint);
    font-size: 14px;
}

/* Comprehensive Mobile Responsiveness */
@media (max-width: 860px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 100;
        height: auto;
        flex-direction: column;
        padding: 12px 16px;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    }

    .sidebar .brand {
        border-bottom: none;
        margin-bottom: 8px;
        padding-bottom: 0;
        justify-content: space-between;
    }

    .nav-group {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 6px;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
    }

    .nav-group::-webkit-scrollbar {
        height: 3px;
    }

    .nav-link {
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 13.5px;
    }

    .nav-link.active {
        border-left-color: transparent;
        border-bottom-color: #fff;
    }

    .sidebar-footer {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding-top: 8px;
        margin-top: 4px;
        border-top: 1px dashed var(--border);
    }

    .sidebar-footer #theme-toggle-btn {
        width: auto !important;
        padding: 6px 12px !important;
        font-size: 11px !important;
    }

    .main {
        padding: 20px 16px 60px;
    }

    .page-head h1 {
        font-size: 34px;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 36px;
    }

    .data-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 14px;
    }

    .match-when {
        min-width: auto;
        font-size: 11.5px;
    }

    .h2h-selector,
    .h2h-scoreboard,
    .reports-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 20px 16px;
    }

    .h2h-vs {
        text-align: center;
        margin: -4px 0;
    }

    .h2h-divider {
        display: none;
    }

    .h2h-name {
        font-size: 26px;
    }

    .h2h-score {
        font-size: 44px;
    }

    .login-card {
        padding: 30px 22px 26px;
    }

    .login-card h1 {
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }
}
