/* ============================================
   Live Scores Dashboard - Dark Theme Styles
   ============================================ */

/* CSS Custom Properties */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2333;
    --bg-hover: #252d3a;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --accent-green: #3fb950;
    --accent-red: #f85149;
    --accent-blue: #58a6ff;
    --accent-yellow: #d29922;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --radius: 8px;
    --transition: all 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.dashboard-header {
    background: linear-gradient(135deg, #1a1f2e 0%, #0d1117 100%);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.dashboard-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.last-updated {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.last-updated .live-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.refresh-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.refresh-btn:hover {
    background: #4090e0;
    transform: translateY(-1px);
}

.refresh-btn:active {
    transform: translateY(0);
}

.refresh-btn.spinning .refresh-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Main Container */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 10px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.tab-nav::-webkit-scrollbar {
    height: 4px;
}

.tab-nav::-webkit-scrollbar-track {
    background: transparent;
}

.tab-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.tab-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.tab-btn .count {
    background: rgba(255, 255, 255, 0.2);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
}

/* League Sections */
.league-section {
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.league-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius) var(--radius) 0 0;
    border-left: 4px solid var(--league-color, var(--accent-blue));
    border-bottom: 1px solid var(--border-color);
}

.league-header .icon {
    font-size: 1.4rem;
}

.league-header .name {
    font-size: 1.1rem;
    font-weight: 600;
}

.league-header .status {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.league-header .status .live-indicator {
    color: var(--accent-green);
    font-weight: 600;
}

/* Game Cards */
.games-list {
    background: var(--bg-card);
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
}

.game-card {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.game-card:last-child {
    border-bottom: none;
}

.game-card:hover {
    background: var(--bg-hover);
}

.game-card.live {
    border-left: 3px solid var(--accent-green);
}

.game-card.scheduled {
    opacity: 0.75;
}

.game-card.final {
    border-left: 3px solid var(--text-muted);
}

/* Team Info */
.team {
    display: flex;
    align-items: center;
    gap: 8px;
}

.team.home {
    justify-content: flex-end;
    text-align: right;
}

.team.away {
    justify-content: flex-start;
    text-align: left;
}

.team-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.team-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.team.losing .team-name {
    color: var(--text-muted);
}

.team.winning .team-name {
    color: var(--text-primary);
    font-weight: 700;
}

/* Score Display */
.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    padding: 0 15px;
}

.scores {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.3rem;
    font-weight: 700;
}

.scores .separator {
    color: var(--text-muted);
    font-weight: 400;
}

.score-home {
    color: var(--text-primary);
}

.score-away {
    color: var(--text-primary);
}

.team.winning .score-home,
.team.winning .score-away {
    color: var(--accent-green);
}

/* Game Status */
.game-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-align: center;
}

.game-status.live {
    color: var(--accent-green);
    font-weight: 600;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.game-status.scheduled {
    color: var(--accent-yellow);
}

/* Broadcast Info */
.broadcast {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* No Games / Error States */
.no-games {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.no-games .icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.no-games .message {
    font-size: 1rem;
    margin-bottom: 5px;
}

.no-games .submessage {
    font-size: 0.85rem;
}

.error-banner {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--accent-red);
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-banner .dismiss {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.7;
}

.error-banner .dismiss:hover {
    opacity: 1;
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* All Sports View */
.all-sports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

@media (min-width: 768px) {
    .all-sports-grid {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
}

@media (min-width: 1200px) {
    .all-sports-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Footer */
.dashboard-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

.dashboard-footer a {
    color: var(--accent-blue);
    text-decoration: none;
}

.dashboard-footer a:hover {
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        padding: 15px;
    }

    .dashboard-header h1 {
        font-size: 1.4rem;
    }

    .dashboard-container {
        padding: 10px;
    }

    .game-card {
        grid-template-columns: 1fr auto 1fr;
        padding: 10px 12px;
        gap: 8px;
    }

    .team-name {
        font-size: 0.85rem;
    }

    .team-logo {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }

    .scores {
        font-size: 1.1rem;
    }

    .score-display {
        min-width: 60px;
        padding: 0 8px;
    }

    .all-sports-grid {
        grid-template-columns: 1fr;
    }

    .tab-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .game-card {
        grid-template-columns: auto 1fr auto;
        gap: 6px;
    }

    .team.home {
        flex-direction: row-reverse;
        justify-content: flex-end;
    }

    .team.away {
        flex-direction: row;
        justify-content: flex-start;
    }

    .score-display {
        min-width: 50px;
    }

    .scores {
        font-size: 1rem;
    }

    .team-name {
        font-size: 0.8rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .dashboard-header,
    .tab-nav,
    .refresh-btn,
    .dashboard-footer {
        display: none;
    }

    .game-card {
        border-bottom: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .tab-content {
        display: block !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles */
.tab-btn:focus,
.refresh-btn:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
