/* CSS Variables - Sale Sports Club Branding */
:root {
    /* Primary Colors - Sale Sports Club */
    --primary-navy: #0C2041;
    --primary-blue: #0872CE;
    --accent-gold: #FFD700;
    --accent-gold-hover: #E6C200;

    --primary-gradient: linear-gradient(135deg, #0C2041 0%, #143A6B 50%, #0872CE 100%);
    --accent-color: #FFD700;
    --accent-hover: #E6C200;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #FFD700;

    /* Backgrounds */
    --bg-primary: #0B2241;
    --bg-secondary: #0C2041;
    --bg-card: rgba(12, 32, 65, 0.9);
    --bg-glass: rgba(8, 114, 206, 0.08);

    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: #A8C5E8;
    --text-muted: #6B8BB8;

    /* Borders & Effects */
    --border-color: rgba(8, 114, 206, 0.25);
    --border-radius: 16px;
    --border-radius-sm: 10px;
    --border-radius-lg: 24px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(8, 114, 206, 0.4);
    --shadow-gold: 0 0 20px rgba(255, 215, 0, 0.3);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at top left, rgba(8, 114, 206, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(255, 215, 0, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* App Container */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.club-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-icon svg {
    width: 30px;
    height: 30px;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.season-badge {
    padding: 0.15rem 0.55rem;
    border-radius: 50px;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.4);
    color: var(--accent-gold);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.logo-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.refresh-btn svg {
    width: 18px;
    height: 18px;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Filter Section */
.filter-section {
    margin-bottom: 2rem;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.filter-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.clear-filter-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clear-filter-btn:hover {
    background: var(--accent-color);
    color: var(--bg-primary);
}

.team-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.team-filter-btn {
    padding: 0.6rem 1.2rem;
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
}

.team-filter-btn:hover {
    background: rgba(74, 127, 181, 0.2);
    border-color: rgba(74, 127, 181, 0.5);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.team-filter-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Date Stats Section */
.date-stats-section {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem 0;
}

.date-stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.date-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 215, 0, 0.4);
}

.date-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 215, 0, 0.1) 100%);
    color: #FFD700;
    flex-shrink: 0;
}

.date-stat-icon svg {
    width: 20px;
    height: 20px;
}

.date-stat-info {
    display: flex;
    flex-direction: column;
}

.date-stat-date {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.date-stat-count {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 500;
}

.date-stat-card {
    cursor: pointer;
}

.date-stat-card.active {
    background: var(--primary-gradient);
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.date-stat-card.active .date-stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.date-stat-card.active .date-stat-date {
    color: white;
}

.date-stat-card.active .date-stat-count {
    color: rgba(255, 255, 255, 0.9);
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-secondary);
}

.loading.hidden {
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Fixtures Grid */
.fixtures-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Team Section */
.team-section {
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.team-section:hover {
    box-shadow: var(--shadow-lg);
}

.team-header {
    background: var(--primary-gradient);
    padding: 1.25rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.team-badge {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.team-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

.fixtures-list {
    padding: 1rem;
}

/* Fixture Card */
.fixture-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: all var(--transition-fast);
}

.fixture-card:last-child {
    margin-bottom: 0;
}

.fixture-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(74, 127, 181, 0.3);
    transform: translateX(4px);
}

.fixture-date-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.fixture-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.fixture-date svg {
    width: 16px;
    height: 16px;
}

.fixture-type {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fixture-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.home-badge {
    background: rgba(16, 185, 129, 0.25);
    color: #10b981;
}

.away-badge {
    background: rgba(139, 92, 246, 0.25);
    color: #a78bfa;
}

.status-badge {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.fixture-card-off .fixture-teams {
    opacity: 0.55;
}

.fixture-type.league {
    background: rgba(8, 114, 206, 0.25);
    color: #60a5fa;
}

.fixture-type.cup {
    background: rgba(255, 215, 0, 0.25);
    color: #FFD700;
}

.fixture-type.division {
    background: rgba(8, 114, 206, 0.2);
    color: #A8C5E8;
}

.fixture-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.fixture-team {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fixture-team.home {
    justify-content: flex-end;
    text-align: right;
}

.fixture-team.away {
    justify-content: flex-start;
}

.fixture-team-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.fixture-team-name.club-team {
    color: var(--accent-color);
}

.fixture-vs {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.fixture-venue {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.fixture-venue svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.update-time {
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    /* Date stats horizontal scroll on mobile */
    .date-stats-section {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        margin: 0 -1rem 1.5rem -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        scrollbar-width: none;
    }

    .date-stats-section::-webkit-scrollbar {
        display: none;
    }

    .date-stat-card {
        min-width: 140px;
        padding: 0.85rem 1rem;
    }

    .date-stat-date {
        font-size: 0.9rem;
    }

    .date-stat-count {
        font-size: 0.8rem;
    }

    /* Team filter improvements */
    .filter-section {
        margin-bottom: 1.5rem;
    }

    .team-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        margin: 0 -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .team-filter-btn {
        flex-shrink: 0;
        padding: 0.65rem 1.1rem;
        font-size: 0.85rem;
        /* Touch-friendly minimum size */
        min-height: 44px;
    }

    .clear-filter-btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    /* Fixture cards */
    .fixture-teams {
        flex-direction: column;
        gap: 0.5rem;
    }

    .fixture-team {
        justify-content: center !important;
        text-align: center !important;
    }

    .fixture-vs {
        width: 30px;
        height: 30px;
    }

    .fixture-card {
        padding: 1rem;
    }

    .fixture-date-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .team-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }

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

    /* Refresh button touch-friendly */
    .refresh-btn {
        min-height: 44px;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .date-stat-card {
        min-width: 125px;
        padding: 0.75rem;
    }

    .date-stat-icon {
        width: 32px;
        height: 32px;
    }

    .date-stat-icon svg {
        width: 16px;
        height: 16px;
    }

    .team-filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

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

    .fixture-venue {
        font-size: 0.8rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.team-section {
    animation: fadeIn 0.5s ease forwards;
}

.team-section:nth-child(1) {
    animation-delay: 0.1s;
}

.team-section:nth-child(2) {
    animation-delay: 0.15s;
}

.team-section:nth-child(3) {
    animation-delay: 0.2s;
}

.team-section:nth-child(4) {
    animation-delay: 0.25s;
}

.team-section:nth-child(5) {
    animation-delay: 0.3s;
}

.team-section:nth-child(6) {
    animation-delay: 0.35s;
}

.team-section:nth-child(7) {
    animation-delay: 0.4s;
}

.team-section:nth-child(8) {
    animation-delay: 0.45s;
}