/**
 * LiveScore Pro - Main Stylesheet
 * Mobile-first responsive design
 */

/* ============================================
   CSS Variables / Design Tokens
   ============================================ */
:root {
    /* Colors */
    --color-primary: #1a73e8;
    --color-primary-dark: #1557b0;
    --color-secondary: #34a853;
    --color-danger: #ea4335;
    --color-warning: #fbbc04;
    --color-live: #ea4335;

    /* Neutral Colors */
    --color-bg: #f5f5f5;
    --color-bg-dark: #1a1a2e;
    --color-surface: #ffffff;
    --color-surface-dark: #252542;
    --color-text: #202124;
    --color-text-light: #5f6368;
    --color-text-muted: #9aa0a6;
    --color-border: #e0e0e0;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Container */
    --container-max: 1200px;
    --header-height: 60px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

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

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

/* ============================================
   Layout
   ============================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.main-content {
    min-height: calc(100vh - var(--header-height) - 200px);
    padding: var(--space-6) 0;
}

/* ============================================
   Header
   ============================================ */
.header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: var(--space-4);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: var(--font-size-xl);
    color: var(--color-primary);
}

.logo-icon {
    font-size: 1.5rem;
}

.main-nav {
    display: none;
    gap: var(--space-1);
}

@media (min-width: 768px) {
    .main-nav {
        display: flex;
    }
}

.nav-link {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-weight: 500;
    color: var(--color-text-light);
    transition: all var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-primary);
    background-color: rgba(26, 115, 232, 0.1);
}

.header-search {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.search-form {
    display: flex;
    align-items: center;
    background-color: var(--color-bg);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4);
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: var(--font-size-sm);
}

.search-btn {
    color: var(--color-text-muted);
    padding: var(--space-1);
}

.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-2);
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background-color: var(--color-text);
    transition: all var(--transition-fast);
}

@media (min-width: 768px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* Date Navigation */
.date-nav {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.date-nav-inner {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) 0;
}

.date-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    min-width: 80px;
    text-align: center;
    transition: all var(--transition-fast);
}

.date-item:hover {
    background-color: var(--color-bg);
}

.date-item.active {
    background-color: var(--color-primary);
    color: white;
}

.date-item.today {
    font-weight: 600;
}

.date-day {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.date-item.active .date-day {
    color: rgba(255, 255, 255, 0.8);
}

.date-num {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

/* ============================================
   Match Card
   ============================================ */
.match-card {
    display: block;
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    transition: all var(--transition-fast);
    border: 1px solid var(--color-border);
}

.match-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.match-card.is-live {
    border-left: 3px solid var(--color-live);
}

.match-competition {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.competition-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.match-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--space-4);
    align-items: center;
}

.match-team {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.match-team.away {
    flex-direction: row-reverse;
    text-align: right;
}

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

.team-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.team-rank {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.match-center {
    text-align: center;
    min-width: 80px;
}

.match-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.score {
    font-size: var(--font-size-2xl);
    font-weight: 700;
}

.score-divider {
    font-size: var(--font-size-lg);
    color: var(--color-text-muted);
}

.match-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    font-size: var(--font-size-xs);
    margin-top: var(--space-1);
}

.match-status.live {
    color: var(--color-live);
}

.live-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--color-live);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.match-time {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.match-date {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.match-footer {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

/* Compact mode */
.match-card.compact {
    padding: var(--space-3);
}

.match-card.compact .match-footer {
    display: none;
}

/* ============================================
   Competition Groups
   ============================================ */
.competition-group {
    margin-bottom: var(--space-6);
}

.competition-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background-color: var(--color-surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--color-border);
    border-bottom: none;
}

.competition-header .competition-logo {
    width: 32px;
    height: 32px;
}

.competition-info {
    flex: 1;
}

.competition-header .competition-name {
    font-weight: 600;
    color: var(--color-text);
}

.competition-header .competition-name:hover {
    color: var(--color-primary);
}

.competition-country {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.match-count {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    background-color: var(--color-bg);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
}

.competition-matches {
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

.competition-matches .match-card {
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
}

.competition-matches .match-card:last-child {
    border-bottom: none;
}

.competition-matches .match-card:hover {
    transform: none;
}

/* ============================================
   Live Banner
   ============================================ */
.live-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: linear-gradient(135deg, var(--color-live), #ff6b6b);
    color: white;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    font-weight: 500;
}

.live-indicator.pulse {
    animation: pulse 1s infinite;
}

/* ============================================
   Popular Leagues
   ============================================ */
.popular-leagues {
    margin-bottom: var(--space-6);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.section-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.leagues-slider {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    padding-bottom: var(--space-2);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.leagues-slider::-webkit-scrollbar {
    display: none;
}

.league-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    min-width: 100px;
    text-align: center;
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
}

.league-item:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.league-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.league-name {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--color-text-light);
}

/* ============================================
   Match Detail Page
   ============================================ */
.page-match {
    max-width: 900px;
    margin: 0 auto;
}

.breadcrumbs {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
}

.breadcrumbs a:hover {
    color: var(--color-primary);
}

.breadcrumbs .separator {
    margin: 0 var(--space-2);
}

.match-header {
    background-color: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    text-align: center;
}

.match-header.is-live {
    border: 2px solid var(--color-live);
}

.match-competition-info {
    margin-bottom: var(--space-4);
}

.match-competition-info a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-primary);
}

.match-score-section {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--space-6);
    align-items: center;
    margin: var(--space-6) 0;
}

.team-block {
    text-align: center;
}

.team-logo-large {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin: 0 auto var(--space-3);
}

.team-block .team-name {
    font-size: var(--font-size-lg);
}

.score-block {
    min-width: 120px;
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.score-display .score {
    font-size: var(--font-size-3xl);
}

.match-status-live {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    color: var(--color-live);
    font-weight: 600;
    margin-top: var(--space-2);
}

.live-dot {
    width: 10px;
    height: 10px;
    background-color: var(--color-live);
    border-radius: 50%;
    animation: pulse 1s infinite;
}

.kickoff-time .time {
    font-size: var(--font-size-3xl);
    font-weight: 700;
}

.kickoff-time .label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.match-venue-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.match-venue-info .icon {
    width: 16px;
    height: 16px;
}

/* Match Tabs */
.match-tabs {
    background-color: var(--color-surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.tabs-nav {
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid var(--color-border);
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    flex: 1;
    min-width: 100px;
    padding: var(--space-4);
    font-weight: 500;
    color: var(--color-text-light);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.tab-btn:hover,
.tab-btn.active {
    color: var(--color-primary);
}

.tab-btn.active {
    border-bottom-color: var(--color-primary);
}

.tab-content {
    display: none;
    padding: var(--space-6);
}

.tab-content.active {
    display: block;
}

/* Stats */
.stats-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.stat-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-4);
    align-items: center;
}

.stat-home,
.stat-away {
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

.stat-bar {
    text-align: center;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
}

.stat-bars {
    display: flex;
    height: 6px;
    background-color: var(--color-bg);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.stat-bars .bar.home {
    background-color: var(--color-primary);
}

.stat-bars .bar.away {
    background-color: var(--color-danger);
}

/* Standings Table */
.standings-table {
    margin-bottom: var(--space-6);
}

.standings-table h4 {
    margin-bottom: var(--space-4);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table th,
.table td {
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
}

.table .pos {
    width: 40px;
    text-align: center;
}

.table .stat {
    width: 40px;
    text-align: center;
}

.table .pts {
    font-weight: 700;
}

.table .team {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

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

.table tr.highlighted {
    background-color: rgba(26, 115, 232, 0.1);
}

.no-data {
    text-align: center;
    padding: var(--space-8);
    color: var(--color-text-muted);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background-color: var(--color-bg-dark);
    color: white;
    padding: var(--space-12) 0 var(--space-6);
    margin-top: var(--space-12);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.footer-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.footer-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.footer-links li {
    margin-bottom: var(--space-2);
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.5);
}

.footer-disclaimer {
    margin-top: var(--space-2);
    font-size: var(--font-size-xs);
}

/* ============================================
   Utility Classes
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all var(--transition-fast);
}

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

.btn-primary:hover {
    background-color: var(--color-primary-dark);
}

.no-matches {
    text-align: center;
    padding: var(--space-12);
    background-color: var(--color-surface);
    border-radius: var(--radius-xl);
}

.no-matches-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
}

.no-matches-text {
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 767px) {
    .match-score-section {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .team-block {
        display: flex;
        align-items: center;
        gap: var(--space-3);
    }

    .team-block.home {
        justify-content: flex-start;
    }

    .team-block.away {
        justify-content: flex-end;
        order: 3;
    }

    .score-block {
        order: 2;
    }

    .team-logo-large {
        width: 48px;
        height: 48px;
        margin: 0;
    }

    .match-content {
        gap: var(--space-2);
    }

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

    .score {
        font-size: var(--font-size-xl);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .header-search {
        max-width: 200px;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-6);
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .date-nav,
    .search-form {
        display: none;
    }

    .main-content {
        padding: 0;
    }
}

/* ============================================
   Live Stream Section
   ============================================ */
.live-stream-section {
    background: linear-gradient(135deg, var(--color-danger), #ff6b6b);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-6);
    margin: var(--space-4) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.live-stream-section.no-stream {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

.live-stream-section.no-stream p {
    color: var(--color-text-muted);
    margin: 0;
}

.stream-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.stream-header h3 {
    color: white;
    margin: 0;
    font-size: var(--font-size-lg);
}

.live-badge {
    background: white;
    color: var(--color-danger);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 700;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.stream-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: white;
    color: var(--color-danger);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stream-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.stream-button .play-icon {
    width: 20px;
    height: 20px;
}
