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

/* CSS Custom Properties for Theme Support */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #333;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;
    --accent-primary: #ff6b35;
    --accent-hover: #e55a2b;
    --border-color: #444444;
    --error-bg: #442222;
    --error-text: #ff4444;
    --success-bg: rgba(0, 128, 0, 0.9);
    --card-bg: #333;
    --shadow: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e0e0e0;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent-primary: #ff6b35;
    --accent-hover: #e55a2b;
    --border-color: #dddddd;
    --error-bg: #ffeaea;
    --error-text: #ff4444;
    --success-bg: rgba(0, 128, 0, 0.9);
    --card-bg: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Home Page Styles */
header {
    text-align: center;
    margin-bottom: 30px;
}

/* Header Layout */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.player-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
}

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

.theme-toggle:active {
    transform: scale(0.95);
}

.loading-spinner {
    text-align: center;
    padding: 20px;
    color: #888;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.menu-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.menu-btn {
    background-color: #333;
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 14px;
}

.menu-btn:hover {
    background-color: #555;
}

.menu-btn.active {
    background-color: #ff6b35;
    color: #fff;
}

.loading {
    text-align: center;
    font-size: 18px;
    color: #888;
    padding: 50px 0;
}

.error {
    text-align: center;
    color: #ff4444;
    padding: 20px;
    background-color: #442222;
    border-radius: 5px;
    margin: 20px 0;
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.channel-card {
    background-color: #2a2a2a;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.channel-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.channel-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px;
    background-color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #888;
}

.channel-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.channel-title {
    margin: 10px 0 8px 0;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-info {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    text-align: left;
}

.match-teams {
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-countdown {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 11px;
    background: rgba(255, 107, 53, 0.1);
    padding: 3px 6px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 2px;
}

/* Player Page Styles */
.player-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #444;
}

.back-btn {
    background-color: #ff6b35;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-right: 15px;
    transition: background-color 0.3s;
}

.back-btn:hover {
    background-color: #e55a2b;
}

.player-header h2 {
    font-size: 1.8em;
    color: #ff6b35;
    flex-grow: 1;
}

.video-container {
    background-color: #000;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

#video-player {
    width: 100%;
    height: 400px;
    background-color: #000;
}

.player-info {
    padding: 20px;
    background-color: #2a2a2a;
    border-radius: 0 0 10px 10px;
}

.player-info h3 {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-status {
    font-size: 14px;
    margin-bottom: 15px;
    padding: 8px 12px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s ease;
}

.stream-status.loading {
    background-color: #444;
    color: #ccc;
}

.stream-status.streaming {
    background-color: #4CAF50;
    color: white;
}

.stream-status.error {
    background-color: #f44336;
    color: white;
}

.stream-status.ready {
    background-color: #2196F3;
    color: white;
}

.loading-spinner {
    text-align: center;
    padding: 20px;
    color: #888;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.video-controls {
    position: absolute;
    bottom: 80px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.video-controls:hover {
    opacity: 1;
}

.play-pause-btn {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background-color 0.3s;
}

.play-pause-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.quality-indicator {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
}

.notification {
    background: rgba(0, 128, 0, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}

.notification.error {
    background: rgba(255, 0, 0, 0.9);
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2em;
    }

    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .channel-card {
        padding: 10px;
    }

    .channel-logo {
        width: 60px;
        height: 60px;
    }

    .channel-title {
        font-size: 12px;
    }

    #video-player {
        height: 300px;
    }

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

    .back-btn {
        margin-bottom: 10px;
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .channel-logo {
        width: 50px;
        height: 50px;
    }

    .channel-title {
        font-size: 11px;
    }

    #video-player {
        height: 250px;
    }
}
