/* 🎨 THEME.CSS - Visual enhancements and advanced components */
/* Load async after critical path - 8KB max */

/* Glassmorphism Effects */
.glassmorphism {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Only apply backdrop-filter on desktop for performance */
@media (min-width: 768px) {
    .glassmorphism-desktop {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Advanced Card Variants */
.card--glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.card--compact {
    padding: var(--space-sm);
}

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

.card--tournament {
    background: linear-gradient(135deg, var(--secondary) 0%, #1e2a3a 100%);
    border: 1px solid rgba(0, 229, 255, 0.3);
}

/* Tournament-specific Components */
.tournament-header {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 20px;
    margin-bottom: var(--space-lg);
    position: relative;
    overflow: hidden;
}

.tournament-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 40%, rgba(0, 229, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.tournament-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--accent);
    margin-bottom: var(--space-sm);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tournament-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    font-weight: 300;
}

/* Player Components */
.player-tag {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 20px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--accent);
    transition: all var(--transition-base);
}

.player-tag:hover {
    background: rgba(0, 229, 255, 0.2);
    transform: translateY(-1px);
}

.player-tag--winner {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
    color: var(--success);
}

.player-tag--absent {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.3);
    color: var(--error);
    opacity: 0.7;
}

/* Match Cards */
.match-card {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

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

.match-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.match-card:hover::before {
    opacity: 1;
}

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

.match-round {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 600;
}

.match-table {
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 16px;
    font-size: var(--font-size-sm);
    font-weight: 600;
}

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

.match-vs {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: var(--font-size-lg);
}

/* Timer Components */
.timer-display {
    text-align: center;
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--secondary) 0%, #1e2a3a 100%);
    border: 2px solid var(--accent);
    border-radius: 16px;
    margin: var(--space-lg) 0;
    position: relative;
}

.timer-time {
    font-size: 3rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
    text-shadow: 0 2px 8px rgba(0, 229, 255, 0.3);
    margin-bottom: var(--space-sm);
}

.timer-status {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    font-weight: 500;
}

.timer-controls {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-md);
}

/* QR Code Components */
.qr-container {
    text-align: center;
    padding: var(--space-lg);
    background: white;
    border-radius: 12px;
    margin: var(--space-md) 0;
    box-shadow: var(--shadow-md);
}

.qr-title {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.qr-code {
    max-width: 200px;
    height: auto;
    margin: 0 auto var(--space-sm);
}

.qr-url {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    word-break: break-all;
    background: #f5f5f5;
    padding: var(--space-xs);
    border-radius: 4px;
}

/* Statistics Components */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.stat-card {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: var(--space-lg);
    text-align: center;
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--accent);
    margin-bottom: var(--space-xs);
}

.stat-label {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Navigation Tabs */
.tab-navigation {
    display: flex;
    background: var(--secondary);
    border-radius: 12px;
    padding: var(--space-xs);
    margin-bottom: var(--space-lg);
    overflow-x: auto;
}

.tab-button {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    min-width: fit-content;
}

.tab-button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-button.active {
    background: var(--accent);
    color: var(--primary);
    font-weight: 600;
}

.tab-content {
    animation: fadeIn 0.3s ease-out;
}

/* Language Selector */
.language-selector {
    position: relative;
    display: inline-block;
}

.language-button {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.language-button:hover {
    border-color: var(--accent);
    background: rgba(0, 229, 255, 0.05);
}

.language-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    margin-top: var(--space-xs);
}

.language-option {
    display: block;
    width: 100%;
    padding: var(--space-sm);
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--transition-base);
    text-align: left;
}

.language-option:hover {
    background: rgba(0, 229, 255, 0.1);
}

.language-option:first-child {
    border-radius: 8px 8px 0 0;
}

.language-option:last-child {
    border-radius: 0 0 8px 8px;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .tournament-title {
        font-size: var(--font-size-2xl);
    }
    
    .timer-time {
        font-size: 2rem;
    }
    
    .match-players {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .match-vs {
        font-size: var(--font-size-base);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tab-navigation {
        margin: 0 -var(--space-sm) var(--space-lg);
        border-radius: 0;
    }
    
    .timer-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tournament-header {
        margin: 0 -var(--space-sm) var(--space-lg);
        border-radius: 0 0 20px 20px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-up {
    animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

/* Error Handling */
.error-boundary {
    padding: var(--space-lg);
    text-align: center;
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.2);
    border-radius: 12px;
    margin: var(--space-lg) 0;
}

.error-title {
    font-size: var(--font-size-xl);
    color: var(--error);
    margin-bottom: var(--space-sm);
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

/* Loading Skeletons */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, rgba(255,255,255,0.05) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-text {
    height: 1em;
    border-radius: 4px;
    margin-bottom: var(--space-xs);
}

.skeleton-card {
    height: 120px;
    border-radius: 12px;
}

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

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .tournament-header {
        background: none !important;
        color: #000 !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border: rgba(255,255,255,0.3);
        --text-secondary: #cccccc;
    }
    
    .card {
        border-width: 2px;
    }
    
    .button {
        border: 2px solid currentColor;
    }
}