:root {
    --bg-color: #0f0f13;
    --panel-bg: rgba(24, 24, 32, 0.6);
    --panel-hover: rgba(34, 34, 46, 0.8);
    --panel-border: rgba(255, 255, 255, 0.06);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent: #f59e0b;
    --accent-glow: rgba(245, 158, 11, 0.4);
    --win-bg: rgba(34, 197, 94, 0.15);
    --win-border: rgba(34, 197, 94, 0.8);
    --lose-bg: rgba(255, 255, 255, 0.02);
    --row-border: rgba(255, 255, 255, 0.03);
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(245, 158, 11, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.03) 0%, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Typography & Header */
.app-header {
    text-align: center;
    padding: 2.5rem 1rem 1rem;
    position: relative;
    z-index: 10;
}

.app-header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.highlight {
    color: var(--accent);
    text-shadow: 0 0 15px var(--accent-glow);
}

.app-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto 1.5rem;
}

.primary-btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.03);
}

.primary-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
}

/* Layout Container */
.app-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem 3rem;
    gap: 2rem;
    align-items: flex-start;
    flex: 1;
}

.standings-pane {
    flex: 1;
    min-width: 550px;
    position: sticky;
    top: 2rem;
}

.matches-pane {
    flex: 1.2;
    min-width: 450px;
}

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    .standings-pane {
        position: static;
        min-width: 100%;
    }
    .matches-pane {
        min-width: 100%;
    }
}

/* Glass Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--row-border);
    background: rgba(0, 0, 0, 0.2);
}

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

/* Standings Table */
.table-container {
    padding: 0;
    overflow-x: auto;
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.standings-table th {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    padding: 1rem;
    border-bottom: 1px solid var(--row-border);
}

.col-pos { width: 60px; }
.col-team { text-align: left !important; width: 40%; }
.col-vs { width: 100px; }

.standings-row {
    transition: all 0.5s ease;
    border-bottom: 1px solid var(--row-border);
    position: relative;
    background-color: transparent;
}

.standings-row:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.standings-row.is-moving {
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    background-color: rgba(255, 255, 255, 0.05);
}

.standings-row td {
    padding: 0.8rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 800;
    font-family: var(--font-heading);
    background: rgba(255, 255, 255, 0.08); /* Dark subtle background */
    color: #fff;
    box-shadow: inset 4px 0 0 transparent; 
}
.rank-1 .rank-badge { box-shadow: inset 4px 0 0 #00ff00; }
.rank-2 .rank-badge, .rank-3 .rank-badge, .rank-4 .rank-badge, .rank-5 .rank-badge, .rank-6 .rank-badge { box-shadow: inset 4px 0 0 #ffff00; }
.rank-7 .rank-badge, .rank-8 .rank-badge, .rank-9 .rank-badge, .rank-10 .rank-badge { box-shadow: inset 4px 0 0 #f97316; }

/* Standings Legend */
.standings-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--row-border);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-main);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 6px;
    height: 18px;
    border-radius: 2px;
}

.bg-semi { background-color: #00ff00; }
.bg-quarti { background-color: #ffff00; }
.bg-playin { background-color: #f97316; }

.text-semi { color: #00ff00; }
.text-quarti { color: #ffff00; }
.text-playin { color: #f97316; }

.team-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
}

.team-logo-small {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.col-vs { font-family: var(--font-heading); color: #fff; }
.col-gse, .col-gsu, .col-dr { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.dr-positive { color: #4ade80; }
.dr-negative { color: #f87171; }

/* Matchdays */
.matchday-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.matchday-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--row-border);
}

.matchday-badge {
    display: inline-block;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-heading);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.matches-list {
    display: flex;
    flex-direction: column;
}

.match-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--row-border);
    min-height: 70px;
    position: relative;
}

.match-row:last-child {
    border-bottom: none;
}

.team-selector {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.team-selector:hover {
    background: var(--panel-hover);
}

.team-selector.team-home {
    justify-content: flex-end;
    padding-right: 1.5rem;
}

.team-selector.team-away {
    justify-content: flex-start;
    padding-left: 1.5rem;
}

.team-selector.is-winner {
    background: var(--win-bg);
    box-shadow: inset 0 0 20px rgba(34, 197, 94, 0.1);
}

.team-selector.is-loser {
    background: var(--lose-bg);
    opacity: 0.5;
    filter: grayscale(100%);
}

.team-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.team-home .team-name { margin-right: 1rem; }
.team-away .team-name { margin-left: 1rem; }

.team-logo-match {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    transition: transform 0.2s ease;
}

.team-selector:hover .team-logo-match {
    transform: scale(1.1);
}

.match-center {
    width: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.15);
    border-left: 1px solid var(--row-border);
    border-right: 1px solid var(--row-border);
    z-index: 2;
}

.vs-text {
    opacity: 0.5;
}

.winner-x {
    color: #4ade80;
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.8rem;
    }
    
    .app-container {
        padding: 0.5rem 0.5rem 2rem;
    }

    .standings-pane, 
    .matches-pane {
        min-width: 100%;
        width: 100%;
    }

    .standings-table th, 
    .standings-row td {
        padding: 0.6rem 0.3rem;
        font-size: 0.85rem;
    }

    .col-pos { width: 30px; }
    .col-vs { width: 50px; }

    .team-cell {
        gap: 0.4rem;
    }

    .team-logo-small {
        width: 24px;
        height: 24px;
    }

    .team-name {
        line-height: 1.1;
    }

    .team-selector {
        padding: 0.5rem 0.2rem;
    }

    .team-home .team-name, 
    .team-away .team-name {
        font-size: 0.75rem;
        margin: 0;
        text-align: center;
    }

    .team-selector.team-home {
        flex-direction: column-reverse;
        justify-content: center;
        gap: 0.4rem;
        padding-right: 0.2rem;
    }

    .team-selector.team-away {
        flex-direction: column;
        justify-content: center;
        gap: 0.4rem;
        padding-left: 0.2rem;
    }

    .team-logo-match {
        width: 32px;
        height: 32px;
    }

    .match-center {
        width: 50px;
        font-size: 0.8rem;
    }
}
