/* ============================================
   World Cup 2026 Tracker — Dark Theme
   ============================================ */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d2e;
    --bg-card: #222639;
    --bg-card-hover: #2a2f45;
    --bg-input: #2a2f45;
    --border: #2e3350;
    --text-primary: #e8eaf0;
    --text-secondary: #8b8fa8;
    --text-muted: #5a5e7a;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);
    --green-border: rgba(34, 197, 94, 0.3);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --red-border: rgba(239, 68, 68, 0.3);
    --yellow: #eab308;
    --yellow-bg: rgba(234, 179, 8, 0.12);
    --yellow-border: rgba(234, 179, 8, 0.3);
    --orange: #f97316;
    --blue: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --max-width: 1200px;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #1a1d2e 0%, #222639 100%);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.header__title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.header__title-highlight { color: var(--accent-light); }
.header__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.header__live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
}
.header__live-dot.live { 
    animation: pulse 1.5s infinite; 
    background: var(--red);
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== LOADING ===== */
.loading {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}
.loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ERROR ===== */
.error {
    text-align: center;
    padding: 40px 20px;
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    border-radius: var(--radius);
    margin: 40px 0;
}

/* ===== SECTIONS ===== */
.section {
    margin: 32px 0;
}
.section__title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* ===== TABS ===== */
.section__tabs, .stats-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 20px;
    width: fit-content;
}
.tab {
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}
.tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.tab--active {
    background: var(--accent) !important;
    color: white !important;
}

/* ===== MATCH CARDS ===== */
.matches-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 768px) {
    .matches-panel {
        grid-template-columns: 1fr;
    }
}

.match-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 24px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.match-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.match-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.match-card__body {
    display: flex;
    align-items: center;
    gap: 16px;
}
.match-card__team {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1rem;
}
.match-card__team--right { justify-content: flex-end; text-align: right; }
.match-card__flag {
    font-size: 1.5rem;
    line-height: 1;
}
.match-card__score {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: var(--font-mono);
    min-width: 60px;
    text-align: center;
    color: var(--text-primary);
}
.match-card__score--live { color: var(--red); }

/* Probabilities bar */
.match-card__probs {
    margin-top: 10px;
    display: flex;
    gap: 4px;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--bg-secondary);
}
.prob-bar {
    height: 100%;
    transition: width 0.5s ease;
}
.prob-bar--home { background: var(--green); }
.prob-bar--away { background: var(--red); }
.prob-bar--draw { background: var(--yellow); }

.match-card__prob-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Odds color coding for today's matches */
.match-card--favorite { border-left: 3px solid var(--green); }
.match-card--even { border-left: 3px solid var(--yellow); }
.match-card--underdog { border-left: 3px solid var(--red); }
.match-card--live { border-left: 3px solid var(--red); animation: livePulse 2s infinite; }
@keyframes livePulse {
    0%, 100% { border-left-color: var(--red); }
    50% { border-left-color: transparent; }
}

/* ===== GROUP STANDINGS ===== */
.group-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}
.group-filter {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.group-filter:hover { border-color: var(--accent); color: var(--text-primary); }
.group-filter--active { background: var(--accent); border-color: var(--accent); color: white; }

.group-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.group-container.hidden { display: none; }

.group-title {
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.standings-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.standings-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(46, 51, 80, 0.5);
}
.standings-table tr:last-child td { border-bottom: none; }
.standings-table tr:hover td { background: rgba(99, 102, 241, 0.03); }
.standings-table .pos { 
    font-weight: 700; 
    color: var(--text-muted);
    width: 30px;
    text-align: center;
}
.standings-table .team-name { font-weight: 600; }
.standings-table .pts { 
    font-weight: 800; 
    font-family: var(--font-mono);
    color: var(--accent-light);
    text-align: center;
}
.standings-table .num { text-align: center; font-family: var(--font-mono); font-size: 0.8rem; }

/* Group matches under standings */
.group-matches {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}
.group-matches__title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.group-match {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s;
}
.group-match:hover { color: var(--accent-light); }
.group-match__score {
    font-family: var(--font-mono);
    font-weight: 600;
    margin: 0 8px;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}
.modal--open { display: block; }
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}
.modal__content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.modal__close:hover { background: var(--red-bg); color: var(--red); }

/* Modal match detail */
.modal-match__header {
    text-align: center;
    margin-bottom: 24px;
}
.modal-match__teams {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 1.3rem;
    font-weight: 700;
}
.modal-match__score-big {
    font-size: 2.5rem;
    font-family: var(--font-mono);
    font-weight: 800;
    color: var(--accent-light);
}
.modal-match__info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 8px;
}

/* Stats grid in modal */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0;
}
.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}
.stat-item__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.stat-item__value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
}
.stat-item__value.green { color: var(--green); }
.stat-item__value.red { color: var(--red); }
.stat-item__value.blue { color: var(--blue); }

/* Chart containers */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 12px 0;
}
.chart-container canvas {
    max-height: 250px;
}

/* Odds history table */
.odds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin: 12px 0;
}
.odds-table th, .odds-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.odds-table th {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.odds-table .prob { font-weight: 600; }
.odds-table .prob-high { color: var(--green); }
.odds-table .prob-mid { color: var(--yellow); }
.odds-table .prob-low { color: var(--red); }

/* ===== FOOTER ===== */
.footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    margin-top: 48px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header__title { font-size: 1.2rem; }
    .match-card { padding: 14px 16px; }
    .match-card__score { font-size: 1.2rem; min-width: 44px; }
    .match-card__team { font-size: 0.85rem; }
    .match-card__flag { font-size: 1.2rem; }
    .standings-table { font-size: 0.75rem; }
    .standings-table th, .standings-table td { padding: 6px 8px; }
    .modal__content { width: 95%; padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .modal-match__teams { font-size: 1rem; gap: 12px; }
    .modal-match__score-big { font-size: 1.8rem; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
