:root {
    --primary-color: #38003c;
    --secondary-color: #e90052;
    --success-color: #00ff87;
    --warning-color: #ff9500;
    --danger-color: #ff3b30;
    --background: #ffffff;
    --surface: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --border: #d2d2d7;
    --shadow: rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #000000;
        --surface: #1c1c1e;
        --text-primary: #f5f5f7;
        --text-secondary: #98989d;
        --border: #38383a;
        --shadow: rgba(255, 255, 255, 0.1);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    padding: 20px;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.view-toggle {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 16px 0;
}

.toggle-btn {
    background-color: transparent;
    color: #007AFF;
    border: 1px solid #007AFF;
    padding: 6px 0;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 75px;
}

.toggle-btn:first-child {
    border-radius: 16px 0 0 16px;
    border-right: 0.5px solid #007AFF;
}

.toggle-btn:last-child {
    border-radius: 0 16px 16px 0;
    border-left: 0.5px solid #007AFF;
}

.toggle-btn.active {
    background-color: #007AFF;
    color: white;
}

.toggle-btn:hover:not(.active) {
    background-color: rgba(0, 122, 255, 0.1);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.favorite-team-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.favorite-team-selector label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.team-dropdown {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    background-color: var(--background);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 200px;
    transition: border-color 0.3s ease;
}

.team-dropdown:hover {
    border-color: var(--primary-color);
}

.team-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(56, 0, 60, 0.1);
}

.hamburger-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 2px 8px var(--shadow);
}

.hamburger-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.hamburger-icon {
    display: inline-block;
}

.last-updated {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading, .error {
    text-align: center;
    padding: 40px;
    font-size: 1.1rem;
    background-color: var(--surface);
    border-radius: 12px;
}

.error {
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
}

.table-wrapper {
    overflow-x: auto;
    background-color: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px var(--shadow);
}

.forecast-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--background);
    border-radius: 8px;
    overflow: hidden;
}

.forecast-table thead {
    background-color: var(--primary-color);
    color: white;
}

.forecast-table th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.forecast-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
}

.forecast-table tbody tr:hover {
    background-color: var(--surface);
}

.forecast-table tbody tr.favorite-team {
    background-color: rgba(56, 0, 60, 0.1);
    border-left: 4px solid var(--primary-color);
}

.forecast-table tbody tr.favorite-team:hover {
    background-color: rgba(56, 0, 60, 0.15);
}

@media (prefers-color-scheme: dark) {
    .forecast-table tbody tr.favorite-team {
        background-color: rgba(56, 0, 60, 0.3);
    }

    .forecast-table tbody tr.favorite-team:hover {
        background-color: rgba(56, 0, 60, 0.4);
    }
}

.forecast-table tbody tr:last-child td {
    border-bottom: none;
}

.col-team {
    width: 70%;
    padding-right: 16px !important;
}

.col-forecast {
    width: 30%;
    text-align: right !important;
    padding-left: 16px !important;
    padding-right: 32px !important;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.team-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.position-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 30px;
    text-align: left;
}

.team-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.team-name {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.2;
}

.team-stats {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

.forecast-points {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.forecast-points-value {
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1.2;
}

.forecast-points-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: lowercase;
    line-height: 1;
}

/* Position-based colors matching iOS app */
.position-champions-league {
    color: #007AFF; /* Blue for Champions League (1-4) */
}

.position-relegation {
    color: #FF3B30; /* Red for relegation (18-20) */
}

.position-mid-table {
    color: var(--text-primary); /* Default for mid-table (5-17) */
}

/* Zone divider rows */
.zone-divider {
    background-color: transparent !important;
}

.zone-divider:hover {
    background-color: transparent !important;
}

.zone-divider td {
    padding: 12px 0 !important;
    border-bottom: none !important;
}

.zone-divider-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.zone-divider-line {
    width: 100%;
    height: 3px;
}

.zone-divider-line.champions-league {
    background-color: #007AFF;
}

.zone-divider-line.relegation {
    background-color: #FF3B30;
}

.zone-divider-text {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.3;
}

.zone-divider-text.champions-league {
    color: #007AFF;
}

.zone-divider-text.relegation {
    color: #FF3B30;
}

.change-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.change-indicator.up {
    color: var(--success-color);
}

.change-indicator.down {
    color: var(--danger-color);
}

.change-indicator.same {
    color: var(--text-secondary);
}

.change-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    padding: 15px;
    background-color: var(--surface);
    border-radius: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer p {
    margin: 5px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .table-wrapper {
        padding: 10px;
        overflow-x: visible; /* Remove horizontal scroll */
    }

    .forecast-table th,
    .forecast-table td {
        padding: 12px 8px;
    }

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

    .position-indicator {
        font-size: 1rem;
        min-width: 24px;
    }

    .team-name {
        font-size: 0.9rem;
    }

    .team-stats {
        font-size: 0.75rem;
    }

    .forecast-points-value {
        font-size: 1.1rem;
    }

    .forecast-points-label {
        font-size: 0.65rem;
    }

    .legend {
        flex-direction: column;
        gap: 10px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .favorite-team-selector {
        width: 100%;
    }

    .team-dropdown {
        width: 100%;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    .forecast-table th,
    .forecast-table td {
        padding: 10px 6px;
    }

    .team-logo {
        width: 20px;
        height: 20px;
    }

    .position-indicator {
        font-size: 0.9rem;
        min-width: 20px;
    }

    .team-name {
        font-size: 0.85rem;
    }

    .team-stats {
        font-size: 0.7rem;
    }

    .team-content {
        gap: 8px;
    }

    .forecast-points-value {
        font-size: 1rem;
    }
}
