/* IPL Fantasy League 2026 - Web Styles */

:root {
    /* Primary Colors - IPL Inspired */
    --primary-color: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #4a90e2;
    --secondary-color: #5f6368;
    --accent-orange: #f57c00;
    --accent-purple: #9c27b0;
    
    /* Status Colors */
    --success-color: #1e8e3e;
    --success-light: #e6f4ea;
    --danger-color: #d93025;
    --danger-light: #fef2f2;
    --warning-color: #f9ab00;
    --warning-light: #fef9e6;
    --info-color: #1976d2;
    --info-light: #e3f2fd;
    
    /* Podium Colors */
    --gold: #ffd700;
    --silver: #c0c0c0;
    --bronze: #cd7f32;
    
    /* Neutral Colors (Light Mode) */
    --bg-color: #f8f9fa;
    --bg-secondary: #e9ecef;
    --card-bg: #ffffff;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;
    --border-color: #dadce0;
    --border-light: #f1f3f4;
    
    /* Chart Colors (8 distinct colors for visualizations) */
    --chart-1: #1a73e8;
    --chart-2: #f57c00;
    --chart-3: #1e8e3e;
    --chart-4: #9c27b0;
    --chart-5: #d93025;
    --chart-6: #0288d1;
    --chart-7: #f9ab00;
    --chart-8: #7cb342;
    
    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-xxl: 3rem;
    
    /* Shadows & Elevation */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --shadow-xl: 0 8px 32px rgba(0,0,0,0.2);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --card-bg: #242424;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-muted: #5f6368;
    --border-color: #3c4043;
    --border-light: #2d2d2d;
    
    /* Adjust shadows for dark mode */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-xl: 0 8px 32px rgba(0,0,0,0.6);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.5;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* === Utility Classes === */

/* Responsive Grid System */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .grid-cols-4,
    .grid-cols-3,
    .grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}

/* Flexbox Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Spacing Utilities */
.m-0 { margin: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

/* Text Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-bold { font-weight: 600; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* Gradient Backgrounds */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.bg-gradient-orange {
    background: linear-gradient(135deg, var(--accent-orange) 0%, #e65100 100%);
}

.bg-gradient-gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
}

/* Glass Morphism Effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Card Elevation Classes */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card-elevated {
    box-shadow: var(--shadow-md);
}

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

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-light) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
    100% { transform: rotate(360deg); }
}

/* Fade In Animation */
.fade-in {
    animation: fadeIn var(--transition-slow) ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    transition: background-color var(--transition-base), border-color var(--transition-base);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: opacity var(--transition-base);
}

.nav-menu {
    display: flex;
    gap: var(--space-xl);
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width var(--transition-base);
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

.nav-user {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    padding-left: var(--space-xl);
    border-left: 1px solid var(--border-color);
}

.nav-user span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all var(--transition-base);
}

.theme-toggle:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.theme-toggle:hover .theme-icon {
    color: white;
}

.theme-icon {
    font-size: 1.1rem;
    color: var(--text-primary);
    transition: color var(--transition-base);
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    color: white !important;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.btn-logout:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Container */
.container {
    max-width: 1400px;
    margin: var(--space-xl) auto;
    padding: 0 var(--space-xl);
    min-height: calc(100vh - 200px);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.page-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: var(--space-xs);
}

.actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

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

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

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

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

.btn-secondary:hover {
    background: #4a4e52;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.login-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

.login-card h2 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.login-card h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--bg-color);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger-color);
    border: 1px solid rgba(217, 48, 37, 0.2);
}

/* Tables */
table {
    width: 100%;
    background: var(--card-bg);
    border-collapse: collapse;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

thead th {
    padding: 0.65rem var(--space-md);
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody td {
    padding: 0.55rem var(--space-md);
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-fast);
}

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

tbody tr:hover {
    background: var(--bg-secondary);
}

.rank {
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    min-width: 50px;
}

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

.points {
    font-weight: 700;
    color: var(--primary-color);
    text-align: right;
    font-size: 0.95rem;
}

.total {
    font-weight: 600;
    color: var(--primary-color);
}

/* Podium Highlighting */
.podium-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-left: 4px solid var(--gold);
}

.podium-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-left: 4px solid var(--silver);
}

.podium-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-left: 4px solid var(--bronze);
}

[data-theme="dark"] .podium-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 255, 255, 0.02) 100%);
}

[data-theme="dark"] .podium-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2) 0%, rgba(255, 255, 255, 0.02) 100%);
}

[data-theme="dark"] .podium-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(255, 255, 255, 0.02) 100%);
}

/* Match Cards */
.match-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

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

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

.match-header h3 {
    color: var(--primary-color);
    margin: 0;
}

.match-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.match-scores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.team-score {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 4px;
}

.team-score .team {
    font-weight: 500;
}

.team-score .score {
    font-weight: 600;
    color: var(--primary-color);
}

.match-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Team Cards (Match Detail) */
.match-results {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.team-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.team-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.team-rank {
    font-size: 2rem;
}

.team-header h3 {
    flex: 1;
    margin: 0;
}

.team-total {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.players-table {
    overflow-x: auto;
}

.players-table table {
    margin: 0;
}

.not-played {
    opacity: 0.5;
}

.dnp {
    text-align: center;
    font-style: italic;
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

.badge.captain {
    background: var(--danger-color);
    color: white;
}

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

/* Master Sheet */
.matches-summary {
    margin-top: 3rem;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.matches-summary h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.matches-summary ul {
    list-style: none;
}

.matches-summary li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.matches-summary li:last-child {
    border-bottom: none;
}

.matches-summary a {
    color: var(--primary-color);
    text-decoration: none;
}

.matches-summary a:hover {
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Error */
.error-container {
    text-align: center;
    padding: 3rem;
}

.error-container h2 {
    color: var(--danger-color);
    margin-bottom: 1rem;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.filter-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Timeline */
.timeline {
    position: relative;
    padding: var(--space-lg) 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--accent-orange) 100%);
    border-radius: var(--radius-full);
}

.timeline-item {
    position: relative;
    padding-left: 80px;
    padding-bottom: var(--space-xl);
    transition: opacity var(--transition-base);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-node {
    position: absolute;
    left: 0;
    top: 0;
}

.node-circle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: 4px solid var(--bg-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.node-circle::before {
    content: '🏏';
    font-size: 1.5rem;
}

.timeline-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.timeline-content:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

/* Match Badge */
.match-badge {
    margin-bottom: var(--space-lg);
}

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

.badge-id {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

/* Scores Grid */
.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.score-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    position: relative;
    transition: all var(--transition-fast);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.score-item.winner {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12) 0%, var(--bg-secondary) 100%);
    border-color: var(--gold);
    border-width: 2px;
}

.winner-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: #7a5c00;
    background: rgba(255,215,0,0.3);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    margin-right: 0.3rem;
    flex-shrink: 0;
}

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

.score-points {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.score-item.winner .score-points {
    color: var(--gold);
}

.winner-indicator {
    display: none;
}

/* Match Stats */
.match-stats {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.match-stats .stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.match-stats .stat-icon {
    font-size: 1.1rem;
}

.match-stats .stat-text {
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-xxl) var(--space-xl);
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    margin: var(--space-xl) 0;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-size: 1.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.filter-label input[type="checkbox"] {
    cursor: pointer;
}

/* Sortable Table */
.master-table-container {
    margin-bottom: var(--space-xxl);
}

.sortable-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color var(--transition-fast);
    position: relative;
    padding-right: 2.5rem;
}

.sortable-table th.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sortable-table th.sortable.active {
    background: rgba(255, 255, 255, 0.15);
}

.sort-icon {
    position: absolute;
    right: 1rem;
    opacity: 0.6;
    font-size: 0.9rem;
}

.sortable-table th.sortable.active .sort-icon {
    opacity: 1;
}

/* Expand Button */
.expand-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
}

.expand-btn.expanded {
    background: var(--primary-dark);
}

.expand-icon {
    transition: transform var(--transition-fast);
    font-size: 0.8rem;
}

/* Player Details Row */
.player-details-row {
    background: var(--bg-secondary) !important;
}

.player-details-row:hover {
    background: var(--bg-secondary) !important;
}

.player-details-container {
    padding: var(--space-md);
}

.player-details-container h4 {
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.squad-total {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    background: var(--info-light);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-sm);
}

.player-card-mini {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    border-top: 3px solid var(--border-color);
    transition: all var(--transition-fast);
}

.player-card-mini:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Role-based top border colors */
.role-batsman { border-top-color: var(--primary-color); }
.role-bowler { border-top-color: var(--danger-color); }
.role-allrounder { border-top-color: var(--success-color); }
.role-wicketkeeper { border-top-color: var(--accent-orange); }

.player-header-mini {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.3rem;
    gap: 0.25rem;
}

.player-name-mini {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
    line-height: 1.3;
    flex: 1;
}

.player-badges {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-shrink: 0;
}

/* Role pill */
.role-pill {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.role-pill.role-batsman { background: rgba(26,115,232,0.1); color: var(--primary-color); border-color: var(--primary-color); }
.role-pill.role-bowler { background: rgba(217,48,37,0.1); color: var(--danger-color); border-color: var(--danger-color); }
.role-pill.role-allrounder { background: rgba(30,142,62,0.1); color: var(--success-color); border-color: var(--success-color); }
.role-pill.role-wicketkeeper { background: rgba(245,124,0,0.1); color: var(--accent-orange); border-color: var(--accent-orange); }

.badge-captain,
.badge-vc {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-captain {
    background: var(--gold);
    color: var(--text-primary);
}

.badge-vc {
    background: var(--silver);
    color: var(--text-primary);
}

.player-stats-mini {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stat-mini {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 700;
}

.stat-mini-label {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

/* Matches Summary */
.matches-summary {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.matches-summary h3 {
    color: var(--text-primary);
    margin-bottom: 0;
    font-size: 1.1rem;
}

.matches-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.matches-sort-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sort-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ms-sort-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.ms-sort-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.matches-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.matches-table thead th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.matches-table tbody .match-row td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.matches-table tbody .match-row:last-child td {
    border-bottom: none;
}

.matches-table tbody .match-row:hover td {
    background: var(--bg-secondary);
}

.match-num-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--primary-light, rgba(59,130,246,0.1));
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.78rem;
    white-space: nowrap;
}

.ms-td-num  { width: 4.5rem; }
.ms-td-teams { font-weight: 600; color: var(--text-primary); }
.ms-td-date { color: var(--text-secondary); white-space: nowrap; }
.ms-td-link { width: 4rem; text-align: right; }

.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-sm);
}

.match-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.match-chip:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
    background: var(--info-light);
}

.match-chip-id {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.85rem;
}

.match-chip-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.match-chip:hover .match-chip-desc {
    color: var(--text-primary);
}

/* Analytics Dashboard */
.tabs-container {
    margin-bottom: var(--space-xl);
}

.tabs {
    display: flex;
    gap: var(--space-sm);
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.tab-btn {
    padding: var(--space-md) var(--space-lg);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

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

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

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: var(--radius-full);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card h3 {
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-size: 1rem;
    font-weight: 600;
}

/* Fixed-height wrapper prevents Chart.js infinite-grow bug */
.chart-wrapper {
    position: relative;
    height: 260px;
    width: 100%;
}

.chart-wrapper canvas {
    position: absolute;
    inset: 0;
}

.chart-card canvas {
    /* legacy fallback for any bare canvas not in a wrapper */
    display: block;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
}

.analytics-table th {
    text-align: left;
    padding: var(--space-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.analytics-table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
}

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

.analytics-table tr:hover {
    background: var(--bg-secondary);
}

.analytics-table .highlight {
    color: var(--primary-color);
    font-weight: 600;
}

.analytics-table .highlight-strong {
    color: var(--gold);
    font-weight: 700;
    font-size: 1.1rem;
}

.trend-indicator {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
}

.trends-table-container {
    overflow-x: auto;
}

/* Player Stats Grid */
.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.player-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    transition: all var(--transition-fast);
}

.player-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.player-stat-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--border-color);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
}

.player-stat-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.stat-value {
    color: var(--primary-color);
    font-weight: 600;
}



/* Footer */
footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 4rem;
}

/* Stats Banner */
.stats-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

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

.stat-card-highlight {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
}

.stat-card-highlight .stat-value,
.stat-card-highlight .stat-label {
    color: white !important;
}

.stat-card-border-blue { border-left: 4px solid var(--primary-color); }
.stat-card-border-green { border-left: 4px solid var(--success-color); }
.stat-card-border-purple { border-left: 4px solid var(--accent-purple); }

.stat-icon {
    font-size: 2rem;
    opacity: 0.9;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Podium Cards */
.podium-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xxl);
    align-items: end;
}

.podium-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
}

.podium-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.podium-card-1 {
    order: 2;
    border-color: var(--gold);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, var(--card-bg) 100%);
    min-height: 220px;
}

.podium-card-2 {
    order: 1;
    border-color: var(--silver);
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1) 0%, var(--card-bg) 100%);
    min-height: 190px;
}

.podium-card-3 {
    order: 3;
    border-color: var(--bronze);
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1) 0%, var(--card-bg) 100%);
    min-height: 190px;
}

.podium-crown {
    font-size: 2rem;
    margin-bottom: var(--space-xs);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.podium-medal {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
}

.podium-rank {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.podium-team {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.podium-points {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.podium-card-1 .podium-points {
    color: var(--gold);
}

.podium-card-2 .podium-points {
    color: var(--silver);
}

.podium-card-3 .podium-points {
    color: var(--bronze);
}

/* Leaderboard Section */
.leaderboard-section {
    margin-bottom: var(--space-xxl);
}

.leaderboard-section h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    font-weight: 600;
}

/* Chart Section */
.chart-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-md);
}

.chart-section h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    font-weight: 600;
}

.chart-container {
    position: relative;
    height: 400px;
    max-width: 100%;
}

/* Hamburger button — hidden on desktop */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform var(--transition-base), opacity var(--transition-base);
    transform-origin: center;
}

.nav-hamburger-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Responsive */
@media (max-width: 768px) {
    .nav-hamburger {
        display: flex;
    }

    .nav-container {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: var(--space-md);
        padding: var(--space-md) 0;
        border-top: 1px solid var(--border-color);
    }

    .nav-menu.nav-menu-open {
        display: flex;
    }

    .nav-user {
        border-left: none;
        padding-left: 0;
        padding-top: var(--space-md);
        border-top: 1px solid var(--border-color);
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .container {
        padding: 0 1rem;
        margin: var(--space-lg) auto;
    }

    table {
        font-size: 0.9rem;
    }

    thead th,
    tbody td {
        padding: 0.75rem 0.5rem;
    }
    
    /* Stats Banner Responsive */
    .stats-banner {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: var(--space-md);
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Podium Cards Responsive */
    .podium-container {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .podium-card-1,
    .podium-card-2,
    .podium-card-3 {
        order: unset;
        min-height: auto;
    }
    
    .podium-medal {
        font-size: 3rem;
    }
    
    .podium-team {
        font-size: 1.25rem;
    }
    
    /* Chart Responsive */
    .chart-container {
        height: 300px;
    }
    
    /* Timeline Responsive */
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item {
        padding-left: 60px;
    }
    
    .node-circle {
        width: 40px;
        height: 40px;
    }
    
    .node-circle::before {
        font-size: 1.2rem;
    }
    
    .timeline-content {
        padding: var(--space-md);
    }
    
    .scores-grid {
        grid-template-columns: 1fr;
    }
    
    .match-stats {
        flex-direction: column;
        gap: var(--space-sm);
        align-items: flex-start;
    }
    
    .match-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .match-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Master Scoresheet Responsive */
    .player-grid {
        grid-template-columns: 1fr;
    }
    
    .matches-grid {
        grid-template-columns: 1fr;
    }
    
    /* Analytics Responsive */
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper {
        height: 250px;
    }

    .chart-card canvas {
        min-height: 250px;
    }
    
    .players-grid {
        grid-template-columns: 1fr;
    }
    
    .analytics-table {
        font-size: 0.9rem;
    }
    
    .analytics-table th,
    .analytics-table td {
        padding: var(--space-sm);
    }
}

@media (max-width: 480px) {
    .stats-banner {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 250px;
    }
    
    /* Timeline Mobile */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        width: 100%;
    }
    
    .timeline::before {
        left: 15px;
    }
    
    .timeline-item {
        padding-left: 45px;
    }
    
    .node-circle {
        width: 30px;
        height: 30px;
    }
    
    .node-circle::before {
        font-size: 1rem;
    }
    
    .badge-title {
        font-size: 1rem;
    }
    
    .score-team {
        font-size: 1rem;
    }
    
    .score-points {
        font-size: 1.25rem;
    }
}
