/* ==================== CSS Variables ==================== */
:root {
    /* Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Dark Theme (Default) */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: #1a1a2e;
    --bg-hover: #252542;
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --border-color: #27273f;
    --border-light: #3f3f5a;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    --gradient-card: linear-gradient(145deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    --gradient-glow: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
    
    /* Layout */
    --sidebar-width: 280px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* Light Theme */
.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==================== App Layout ==================== */
#app {
    display: flex;
    min-height: 100vh;
}

/* ==================== Sidebar ==================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo i {
    font-size: 1.75rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-small {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    padding: 16px 12px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 20px;
}

/* Categories */
.categories-section {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.categories-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding: 0 8px;
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.category-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.category-item.active {
    background: var(--bg-hover);
    color: var(--primary-light);
}

.category-item .count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.user-info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.guest-section .btn {
    font-size: 0.875rem;
}

/* ==================== Main Content ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.main-header {
    height: var(--header-height);
    padding: 0 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-container i {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
}

.search-container input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-container input::placeholder {
    color: var(--text-muted);
}

.search-container kbd {
    position: absolute;
    right: 12px;
    background: var(--bg-hover);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 32px;
    background: var(--bg-primary);
    background-image: var(--gradient-glow);
    background-attachment: fixed;
}

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

.section-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h1 i {
    color: var(--primary);
}

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

/* ==================== Player Section ==================== */
.player-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.player-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.player-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.player-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.player-error {
    text-align: center;
    color: white;
}

.player-error i {
    font-size: 3rem;
    color: var(--danger);
    margin-bottom: 16px;
}

.player-error p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.loading-spinner {
    font-size: 3rem;
    color: var(--primary);
}

.player-info {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
}

.player-channel-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.player-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 4px;
}

.player-channel-info h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.player-category {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.player-actions {
    display: flex;
    gap: 12px;
}

/* ==================== Channels Grid ==================== */
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.channel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.channel-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-card);
    opacity: 0;
    transition: opacity var(--transition);
}

.channel-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.15);
}

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

.channel-logo-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

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

.channel-logo-placeholder {
    font-size: 2rem;
    color: var(--text-muted);
}

.channel-name {
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.channel-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    position: relative;
}

.channel-country {
    display: flex;
    align-items: center;
    gap: 4px;
}

.channel-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--warning);
    font-size: 1rem;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition);
}

.channel-card:hover .channel-favorite,
.channel-card.is-favorite .channel-favorite {
    opacity: 1;
    transform: scale(1);
}

.channel-card.is-favorite .channel-favorite {
    color: var(--warning);
}

/* ==================== Loading & Empty States ==================== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.loading-animation {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.loading-bar {
    width: 8px;
    height: 40px;
    background: var(--primary);
    border-radius: 4px;
    animation: loading-pulse 1s ease-in-out infinite;
}

.loading-bar:nth-child(2) {
    animation-delay: 0.15s;
}

.loading-bar:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes loading-pulse {
    0%, 100% {
        transform: scaleY(0.4);
        opacity: 0.5;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ==================== Modal ==================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
}

.auth-modal {
    width: 420px;
    padding: 32px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.close-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: var(--danger);
    color: white;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--border-radius);
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

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

.auth-tab.active {
    background: var(--primary);
    color: white;
}

/* Auth Form */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

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

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

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

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--primary);
    border-color: var(--primary);
}

/* ==================== Utilities ==================== */
.hidden {
    display: none !important;
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ==================== Mini Player (Picture-in-Picture) ==================== */
.mini-player {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    z-index: 9999;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: slideInUp 0.3s ease;
}

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

.mini-player.hidden {
    display: none;
}

.mini-player:hover {
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.3);
    border-color: var(--primary);
}

.mini-player-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    cursor: pointer;
}

.mini-player-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mini-player-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    pointer-events: none;
}

.mini-player-title {
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-player-controls {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    padding: 8px;
    background: var(--bg-tertiary);
}

.mini-player-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

/* Mini Player Audio Indicator */
.mini-player-audio-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-light);
    margin-bottom: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Mini Player Responsive */
@media (max-width: 480px) {
    .mini-player {
        width: 280px;
        bottom: 10px;
        right: 10px;
    }
}

/* ==================== Responsive ==================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

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

@media (max-width: 640px) {
    .content-area {
        padding: 16px;
    }

    .main-header {
        padding: 0 16px;
    }

    .search-container kbd {
        display: none;
    }

    .channels-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .channel-card {
        padding: 16px;
    }

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

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

    .auth-modal {
        width: 100%;
        margin: 16px;
        padding: 24px;
    }

    .player-info {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .player-channel-info {
        flex-direction: column;
    }

    .player-actions {
        width: 100%;
    }

    .player-actions .btn {
        flex: 1;
    }
}

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

.channel-card {
    animation: fadeIn 0.4s ease backwards;
}

.channels-grid .channel-card:nth-child(1) { animation-delay: 0.02s; }
.channels-grid .channel-card:nth-child(2) { animation-delay: 0.04s; }
.channels-grid .channel-card:nth-child(3) { animation-delay: 0.06s; }
.channels-grid .channel-card:nth-child(4) { animation-delay: 0.08s; }
.channels-grid .channel-card:nth-child(5) { animation-delay: 0.1s; }
.channels-grid .channel-card:nth-child(6) { animation-delay: 0.12s; }
.channels-grid .channel-card:nth-child(7) { animation-delay: 0.14s; }
.channels-grid .channel-card:nth-child(8) { animation-delay: 0.16s; }
.channels-grid .channel-card:nth-child(9) { animation-delay: 0.18s; }
.channels-grid .channel-card:nth-child(10) { animation-delay: 0.2s; }

/* ==================== Sort Section ==================== */
.sort-section {
    padding: 12px 16px;
}

.sort-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding: 0 4px;
}

.sort-toggle {
    display: flex;
    gap: 6px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--border-radius);
}

.sort-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

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

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

/* ==================== Country/Category Hierarchy ==================== */
.country-group {
    margin-bottom: 4px;
}

.country-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.country-header:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.country-header.active {
    background: var(--bg-hover);
    color: var(--primary-light);
}

.country-header .expand-icon {
    transition: transform var(--transition-fast);
}

.country-header.expanded .expand-icon {
    transform: rotate(90deg);
}

.country-header .count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 8px;
}

.country-header .flag {
    font-size: 1.1rem;
}

.sub-categories {
    display: none;
    padding-left: 16px;
    margin-top: 4px;
}

.sub-categories.expanded {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sub-category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.sub-category-item:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.sub-category-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.sub-category-item .count {
    margin-left: auto;
    font-size: 0.7rem;
}

/* ==================== Audio Track Section ==================== */
.player-controls-extra {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.audio-track-section {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
    padding: 8px 14px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.audio-track-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.audio-track-section label i {
    color: var(--primary);
}

.audio-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 150px;
    transition: all var(--transition-fast);
}

.audio-select:hover {
    border-color: var(--primary);
}

.audio-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.audio-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
}

/* Player info responsive adjustment */
.player-info {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 900px) {
    .player-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .player-controls-extra {
        width: 100%;
    }
    
    .audio-track-section {
        width: 100%;
    }
    
    .audio-select {
        flex: 1;
    }
}

/* Breadcrumb for sub-navigation */
.nav-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 0.8rem;
}

.nav-breadcrumb button {
    background: none;
    border: none;
    color: var(--primary-light);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.nav-breadcrumb button:hover {
    background: var(--bg-hover);
}

.nav-breadcrumb span {
    color: var(--text-muted);
}

.nav-breadcrumb .current {
    color: var(--text-secondary);
}

/* ==================== Mobile Menu Button ==================== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    z-index: 200;
    transition: all var(--transition);
}

.mobile-menu-btn:hover {
    transform: scale(1.1);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Sidebar Close Button */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-close-btn:hover {
    background: var(--danger);
    color: white;
}

@media (max-width: 1024px) {
    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar-header {
        padding-top: 48px;
    }
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ==================== Admin Modal ==================== */
.admin-modal {
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.admin-modal .modal-header {
    padding: 16px 20px;
    gap: 16px;
}

.admin-modal .modal-header h2 {
    flex: 1;
}

.admin-section {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.admin-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 1rem;
    color: var(--text-primary);
}

.admin-section h3 i {
    color: var(--primary);
}

.admin-section-btn {
    margin-bottom: 12px;
}

.admin-btn {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.admin-btn:hover {
    background: var(--primary) !important;
    color: white !important;
}

/* Upload Tabs */
.upload-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.upload-tab {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.upload-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.upload-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.upload-section {
    display: none;
}

.upload-section.active {
    display: block;
}

/* File Drop Zone */
.file-drop-zone {
    padding: 32px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.file-drop-zone i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.file-drop-zone p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.file-link {
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
}

.file-name {
    display: block;
    color: var(--success);
    font-weight: 500;
    margin-top: 8px;
}

/* Success Message */
.success-message {
    padding: 12px;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--success);
    border-radius: 8px;
    color: var(--success);
    margin-bottom: 16px;
    display: none;
}

.success-message.show {
    display: block;
}

/* M3U Sources List */
.m3u-sources-list {
    max-height: 200px;
    overflow-y: auto;
}

.m3u-source-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}

.m3u-source-info {
    flex: 1;
}

.m3u-source-name {
    font-weight: 500;
    color: var(--text-primary);
}

.m3u-source-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.m3u-source-delete {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.m3u-source-delete:hover {
    background: var(--danger);
    color: white;
}

/* ==================== Importierte Listen Navigation ==================== */
.imported-sources-divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

.nav-section-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: 12px;
    padding: 0 8px;
}

.nav-section-subtitle i {
    font-size: 0.75rem;
}

.imported-source .country-header {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.imported-source .country-header:hover {
    background: rgba(99, 102, 241, 0.15);
}

.imported-source .country-header.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

.imported-source .country-header i:first-child {
    color: var(--primary);
}

/* Custom Channel Badge */
.channel-card.is-custom {
    border-color: rgba(99, 102, 241, 0.3);
}

.channel-card.is-custom::before {
    background: var(--gradient-primary);
}

.custom-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    z-index: 2;
}

.empty-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 16px;
}

.empty-text.small {
    font-size: 0.75rem;
    padding: 8px 12px;
}

.empty-lists-hint {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
}

.empty-lists-hint i.fa-info-circle {
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--primary-light);
    opacity: 0.5;
}

.empty-lists-hint p {
    font-size: 0.85rem;
    margin: 4px 0;
}

.empty-lists-hint i.fa-cog {
    color: var(--primary-light);
}

/* ==================== EPG Styles ==================== */
.admin-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.epg-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--bg-hover);
    transition: var(--transition);
    border-radius: 26px;
    border: 1px solid var(--border-color);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    transition: var(--transition);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
    border-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    background-color: white;
    transform: translateX(22px);
}

.epg-urls-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.epg-url-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.epg-url-item input[type="text"] {
    flex: 1;
    min-width: 0;
}

.epg-url-item .btn-icon-danger {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.epg-url-item .btn-icon-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.8rem;
}

.epg-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.epg-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    display: none;
}

.epg-status.success {
    display: block;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--success);
    color: var(--success);
}

.epg-status.error {
    display: block;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* EPG Info im Player */
.player-epg {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.player-epg.hidden {
    display: none;
}

.epg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.epg-header i {
    color: var(--accent);
}

.epg-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.epg-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 12px;
}

.epg-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.epg-item.current {
    background: rgba(var(--accent-rgb), 0.1);
    border: 1px solid var(--accent);
}

.player-epg-current {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.player-epg-now {
    background: var(--success);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.epg-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.epg-badge.now {
    background: var(--success);
    color: white;
}

.epg-badge.next {
    background: var(--text-muted);
    color: white;
}

.epg-info {
    flex: 1;
    min-width: 0;
}

.player-epg-title {
    font-weight: 600;
    color: var(--text-primary);
}

.epg-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.player-epg-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.epg-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.player-epg-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
    line-height: 1.5;
}

.epg-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.4;
}

.epg-desc.collapsed {
    max-height: 60px;
    overflow: hidden;
    position: relative;
}

.epg-desc.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(transparent, var(--bg-card));
    pointer-events: none;
}

.epg-desc-container {
    margin-top: 6px;
}

.epg-expand-btn {
    background: none;
    border: none;
    color: var(--primary-light);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color var(--transition-fast);
}

.epg-expand-btn:hover {
    color: var(--primary);
}

.epg-expand-btn i {
    font-size: 0.65rem;
}

.player-epg-next {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.player-epg-next strong {
    color: var(--text-secondary);
}

.epg-no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 12px;
    font-style: italic;
}

/* EPG Badge auf Channel Card */
.channel-card .epg-now-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(8px);
    transition: all var(--transition);
}

.channel-card:hover .epg-now-badge {
    opacity: 1;
    transform: translateY(0);
}

/* ==================== EPG Seite / TV-Programm ==================== */
.epg-section {
    padding: 24px;
}

.epg-section.hidden {
    display: none;
}

.epg-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.epg-section .section-header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
}

.epg-section .section-header h1 i {
    color: var(--accent);
}

.epg-time-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.epg-current-time {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
    text-align: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* EPG Tabs */
.epg-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    width: fit-content;
}

.epg-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.epg-tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.epg-tab i {
    font-size: 1rem;
}

/* EPG Grid Container */
.epg-grid {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.epg-grid .epg-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
    gap: 16px;
}

.epg-grid .epg-loading i {
    font-size: 2rem;
}

/* EPG Tabelle */
.epg-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.epg-table-wrapper {
    overflow-x: auto;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* EPG Header (Zeitschiene) */
.epg-time-header {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.epg-time-header-channel {
    width: 180px;
    min-width: 180px;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    position: sticky;
    left: 0;
    z-index: 11;
}

.epg-time-slot {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
}

.epg-time-slot.now {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
}

/* EPG Zeile (pro Sender) */
.epg-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    min-height: 70px;
}

.epg-row:last-child {
    border-bottom: none;
}

.epg-row:hover {
    background: var(--bg-tertiary);
}

/* EPG Sender-Info */
.epg-channel-info {
    width: 180px;
    min-width: 180px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    left: 0;
    z-index: 5;
    cursor: pointer;
    transition: background var(--transition);
}

.epg-channel-info:hover {
    background: var(--bg-tertiary);
}

.epg-channel-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--bg-tertiary);
    padding: 4px;
}

.epg-channel-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* EPG Programme Container */
.epg-programs {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* EPG Programm-Block */
.epg-program {
    padding: 8px 12px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
    overflow: hidden;
}

.epg-program:hover {
    background: rgba(var(--accent-rgb), 0.1);
}

.epg-program.now {
    background: rgba(var(--accent-rgb), 0.15);
    border-left: 3px solid var(--accent);
}

.epg-program-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.epg-program-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.epg-program-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* EPG No Data */
.epg-no-programs {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* EPG Tooltip */
.epg-tooltip {
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    max-width: 300px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    pointer-events: none;
}

.epg-tooltip-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.epg-tooltip-time {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 8px;
}

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

/* Responsive EPG */
@media (max-width: 768px) {
    .epg-section {
        padding: 16px;
    }
    
    .epg-section .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .epg-channel-info {
        width: 120px;
        min-width: 120px;
        padding: 8px;
    }
    
    .epg-channel-logo {
        width: 32px;
        height: 32px;
    }
    
    .epg-channel-name {
        font-size: 0.8rem;
    }
    
    .epg-time-header-channel {
        width: 120px;
        min-width: 120px;
    }
    
    .epg-program {
        padding: 6px 8px;
    }
    
    .epg-program-title {
        font-size: 0.75rem;
    }
}

/* ==================== TV Mode Optimizations ==================== */
/* Diese Styles werden nur aktiviert wenn tv-mode Klasse auf body ist */

/* TV-spezifische Media Query - nur große Bildschirme */
@media screen and (min-width: 1920px) {
    .tv-mode {
        /* Optimierungen für 10-foot UI */
        --sidebar-width: 350px;
        --header-height: 80px;
    }
    
    /* Größere Touch-Targets für Fernbedienung */
    .tv-mode .channel-item {
        min-height: 100px;
        padding: 20px;
        font-size: 1.1rem;
        border: 3px solid transparent;
        transition: all 0.2s ease;
    }
    
    .tv-mode .channel-logo {
        width: 80px;
        height: 80px;
    }
    
    .tv-mode .channel-name {
        font-size: 1.4rem;
        font-weight: 600;
    }
    
    .tv-mode .channel-category,
    .tv-mode .channel-country {
        font-size: 1rem;
    }
    
    /* Navigation größer */
    .tv-mode .nav-item {
        min-height: 70px;
        padding: 20px 24px;
        font-size: 1.3rem;
        border-left: 4px solid transparent;
    }
    
    .tv-mode .nav-item i {
        font-size: 1.5rem;
        margin-right: 16px;
    }
    
    /* Buttons optimiert */
    .tv-mode button,
    .tv-mode .btn {
        min-height: 60px;
        padding: 16px 32px;
        font-size: 1.2rem;
        border-radius: 14px;
    }
    
    .tv-mode .btn i {
        font-size: 1.3rem;
    }
    
    /* Grid angepasst */
    .tv-mode .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 30px;
        padding: 30px;
    }
    
    /* Category Items */
    .tv-mode .category-item,
    .tv-mode .country-item {
        min-height: 70px;
        padding: 18px 24px;
        font-size: 1.2rem;
    }
    
    /* Search */
    .tv-mode #searchInput {
        height: 60px;
        font-size: 1.2rem;
        padding: 0 50px 0 24px;
    }
    
    /* Video Player */
    .tv-mode .video-player {
        max-width: 96vw;
        max-height: 92vh;
    }
    
    .tv-mode .video-controls {
        padding: 24px;
        gap: 20px;
    }
    
    .tv-mode .video-controls button {
        min-width: 56px;
        min-height: 56px;
        font-size: 1.3rem;
    }
    
    /* Sidebar */
    .tv-mode .sidebar {
        width: 350px;
    }
    
    .tv-mode .main-content {
        margin-left: 350px;
        padding: 30px;
    }
    
    /* Logo */
    .tv-mode .logo {
        font-size: 2rem;
        padding: 24px;
    }
    
    .tv-mode .logo i {
        font-size: 2.2rem;
    }
    
    /* User Info */
    .tv-mode .user-info {
        padding: 24px;
        font-size: 1.1rem;
    }
    
    /* Modal */
    .tv-mode .modal-content {
        padding: 40px;
        border-radius: 20px;
    }
    
    .tv-mode .modal-header h2 {
        font-size: 2rem;
    }
    
    /* Form Elements */
    .tv-mode input,
    .tv-mode select,
    .tv-mode textarea {
        min-height: 56px;
        font-size: 1.1rem;
        padding: 16px 20px;
        border-radius: 12px;
    }
    
    .tv-mode label {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    /* EPG optimiert */
    .tv-mode .epg-header {
        font-size: 1.2rem;
        padding: 20px;
    }
    
    .tv-mode .epg-program {
        min-height: 70px;
        padding: 18px;
        font-size: 1.1rem;
    }
    
    /* Scrollbars größer */
    .tv-mode ::-webkit-scrollbar {
        width: 16px;
        height: 16px;
    }
    
    .tv-mode ::-webkit-scrollbar-thumb {
        border-radius: 10px;
    }
}

/* TV Focus Styling - nur wenn TV erkannt wird */
.tv-mode .tv-focused {
    outline: 5px solid var(--primary) !important;
    outline-offset: 6px;
    background: var(--bg-hover) !important;
    transform: scale(1.05);
    z-index: 100;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.7),
                0 10px 30px rgba(0, 0, 0, 0.5) !important;
    border-color: var(--primary) !important;
}

/* Cursor verstecken im TV Modus */
.tv-mode,
.tv-mode * {
    cursor: none !important;
}

/* TV Mode Indicator (optional, für Debugging) */
.tv-mode::before {
    content: '📺 TV Mode';
    position: fixed;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 9999;
    opacity: 0.8;
    pointer-events: none;
}

/* Animationen für TV */
.tv-mode .tv-focused {
    animation: tvFocusPulse 2s ease-in-out infinite;
}

@keyframes tvFocusPulse {
    0%, 100% {
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.7),
                    0 10px 30px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 60px rgba(99, 102, 241, 0.9),
                    0 10px 40px rgba(0, 0, 0, 0.6);
    }
}

/* Optimierungen für Video Playback auf TV */
.tv-mode video {
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast;
}

/* Bessere Lesbarkeit auf großen Bildschirmen */
.tv-mode {
    letter-spacing: 0.02em;
    line-height: 1.7;
}

/* Mini-Player im TV Modus angepasst */
.tv-mode .mini-player {
    width: 450px;
    height: 270px;
}

.tv-mode .mini-player video {
    border-radius: 12px;
}
