/**
 * IPTV Player Styles
 * Modern design with dark mode support
 */

/* ========================================
   IPTV PAGE LAYOUT
   ======================================== */

.iptv-page {
    padding: var(--space-xl) 0 var(--space-2xl);
    min-height: 80vh;
}

.iptv-page .main-content {
    display: block;
}

/* ========================================
   IPTV HEADER
   ======================================== */

.iptv-header {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--border-color);
}

.iptv-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.iptv-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0;
}

/* ========================================
   PLAYER SECTION
   ======================================== */

.iptv-player-section {
    margin-bottom: var(--space-xl);
}

.iptv-player-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.iptv-player-container {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* Video.js Player */
.iptv-player-container .video-js {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.iptv-player-container .vjs-poster {
    background-size: cover;
}

/* Player Overlay */
.iptv-player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 10;
    transition: opacity 0.3s ease;
}

.iptv-player-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.iptv-player-overlay .overlay-content {
    text-align: center;
    color: #fff;
}

.iptv-player-overlay .overlay-content i {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.7;
    animation: pulse 2s infinite;
}

.iptv-player-overlay .overlay-content p {
    font-size: 1.2rem;
    opacity: 0.8;
}

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

/* Now Playing Bar */
.iptv-now-playing {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-radius: 0 0 12px 12px;
    margin-top: -4px;
}

.iptv-now-playing img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    padding: 4px;
}

.now-playing-info {
    display: flex;
    flex-direction: column;
}

.now-playing-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

/* ========================================
   CONTROLS BAR
   ======================================== */

.iptv-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: 10px;
}

/* Search Input */
.iptv-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.iptv-search i {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.iptv-search input {
    width: 100%;
    padding: var(--space-sm) var(--space-md) var(--space-sm) calc(var(--space-md) * 2 + 16px);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.iptv-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

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

/* View Toggle */
.iptv-view-toggle {
    display: flex;
    gap: var(--space-xs);
}

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

.view-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.view-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

/* Channel Count */
.iptv-channel-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border-radius: 20px;
}

.iptv-channel-count span {
    font-weight: 700;
    color: var(--accent-primary);
}

/* ========================================
   LOADING STATE
   ======================================== */

.iptv-loading {
    text-align: center;
    padding: var(--space-2xl);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto var(--space-md);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.iptv-loading p {
    color: var(--text-secondary);
}

.iptv-loading.hidden {
    display: none;
}

/* ========================================
   CHANNEL GRID
   ======================================== */

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

/* List View */
.iptv-channels-grid.list-view {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
}

/* Channel Card */
.iptv-channel-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: var(--space-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

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

.iptv-channel-card.active {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(196, 30, 58, 0.1) 0%, transparent 100%);
}

.iptv-channel-card.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-primary);
}

/* Channel Logo */
.channel-logo {
    width: 70px;
    height: 70px;
    margin: 0 auto var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
}

.channel-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

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

/* Channel Name */
.channel-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* List View Card Styles */
.iptv-channels-grid.list-view .iptv-channel-card {
    display: flex;
    align-items: center;
    text-align: left;
    padding: var(--space-sm) var(--space-md);
}

.iptv-channels-grid.list-view .channel-logo {
    width: 50px;
    height: 50px;
    margin: 0 var(--space-md) 0 0;
    flex-shrink: 0;
}

.iptv-channels-grid.list-view .channel-name {
    flex: 1;
}

/* ========================================
   NO RESULTS
   ======================================== */

.iptv-no-results {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.iptv-no-results i {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* ========================================
   VIDEO.JS CUSTOM THEME
   ======================================== */

/* Control Bar */
.video-js .vjs-control-bar {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    height: 50px;
}

/* Play Button */
.video-js .vjs-big-play-button {
    width: 80px;
    height: 80px;
    line-height: 80px;
    font-size: 3rem;
    border: none;
    border-radius: 50%;
    background: var(--accent-primary);
    transition: all var(--transition-fast);
}

.video-js:hover .vjs-big-play-button {
    background: var(--accent-hover);
    transform: scale(1.1);
}

/* Progress Bar */
.video-js .vjs-play-progress {
    background: var(--accent-primary);
}

.video-js .vjs-volume-level {
    background: var(--accent-primary);
}

/* Slider */
.video-js .vjs-slider {
    background: rgba(255, 255, 255, 0.3);
}

/* Loading Spinner */
.video-js .vjs-loading-spinner {
    border-color: var(--accent-primary);
}

/* ========================================
   DARK MODE ADJUSTMENTS
   ======================================== */

[data-theme="dark"] .iptv-player-container {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .iptv-channel-card {
    background: var(--bg-card);
}

[data-theme="dark"] .iptv-channel-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .channel-logo {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .channel-logo img {
    filter: brightness(0.95);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .iptv-title {
        font-size: 1.75rem;
    }
    
    .iptv-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .iptv-search {
        min-width: 100%;
    }
    
    .iptv-view-toggle {
        justify-content: center;
    }
    
    .iptv-channel-count {
        text-align: center;
    }
    
    .iptv-channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .iptv-player-overlay .overlay-content i {
        font-size: 3rem;
    }
    
    .iptv-now-playing {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .iptv-channels-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .channel-name {
        font-size: 0.8rem;
    }
}

/* ========================================
   EPG - PROGRAM GUIDE
   ======================================== */

.iptv-epg {
    margin-top: var(--space-md);
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    min-height: 150px;
    border: 2px solid var(--border-color);
}

.epg-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.epg-header i {
    font-size: 1.1rem;
}

.epg-content {
    padding: var(--space-lg);
}

.epg-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-lg) var(--space-md);
}

.epg-placeholder i {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.4;
    display: block;
}

.epg-placeholder p {
    margin: 0;
    font-size: 1rem;
}

.epg-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: var(--space-lg);
}

.epg-loading i {
    margin-right: var(--space-sm);
    color: var(--accent-primary);
}

/* EPG Content Styles */
.epg-no-data,
.epg-no-current {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-lg);
}

.epg-no-data i,
.epg-no-current i {
    margin-right: var(--space-xs);
}

/* Current Program */
.epg-current {
    margin-bottom: var(--space-lg);
}

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

.epg-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.epg-live-badge i {
    font-size: 8px;
    animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

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

.epg-current-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

/* Progress Bar */
.epg-progress {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: var(--space-xs);
}

.epg-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-hover));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.epg-remaining {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.epg-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: var(--space-sm);
    background: var(--bg-primary);
    border-radius: 8px;
    max-height: 80px;
    overflow-y: auto;
}

/* Next Programs */
.epg-next {
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-md);
}

.epg-next-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

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

.epg-next-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.epg-next-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
}

.epg-next-time {
    flex-shrink: 0;
    width: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.epg-next-title {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Dark Mode EPG */
[data-theme="dark"] .iptv-epg {
    background: var(--bg-card);
}

[data-theme="dark"] .epg-description {
    background: rgba(0, 0, 0, 0.2);
}

/* EPG Responsive */
@media (max-width: 768px) {
    .iptv-epg {
        padding: var(--space-md);
    }

    .epg-current-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }

    .epg-current-title {
        font-size: 1.1rem;
    }

    .epg-description {
        max-height: 60px;
    }
}
