/* Iframe Overlay Styles */
.iframe-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.iframe-overlay.show {
    opacity: 1;
    visibility: visible;
}

.iframe-container {
    width: 95%;
    height: 95%;
    max-width: 1400px;
    max-height: 900px;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Header */
.iframe-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-bottom: 1px solid #34495e;
}

.iframe-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.iframe-title {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.iframe-category {
    margin: 0;
    color: #bdc3c7;
    font-size: 14px;
    text-transform: capitalize;
}

.iframe-source-badge {
    background: #e74c3c;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.close-iframe-btn {
    background: none;
    border: none;
    color: #bdc3c7;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-iframe-btn:hover {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.close-iframe-btn svg {
    width: 20px;
    height: 20px;
}

/* Content */
.iframe-content {
    flex: 1;
    position: relative;
    background: #000;
}

#tv-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

/* Loading */
.iframe-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 10;
}

.iframe-loading .loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #34495e;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.iframe-loading p {
    margin: 0;
    font-size: 16px;
    color: #bdc3c7;
}

/* Error */
.iframe-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 40px;
    z-index: 10;
}

.iframe-error .error-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.iframe-error h4 {
    margin: 0 0 15px 0;
    font-size: 24px;
    color: #e74c3c;
}

.iframe-error .error-message {
    margin: 0 0 30px 0;
    font-size: 16px;
    color: #bdc3c7;
    max-width: 400px;
    line-height: 1.5;
}

.iframe-error button {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin: 0 10px;
    transition: all 0.2s ease;
}

.iframe-error button:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.iframe-error .fallback-btn {
    background: #95a5a6;
}

.iframe-error .fallback-btn:hover {
    background: #7f8c8d;
}

/* Controls */
.iframe-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-top: 1px solid #34495e;
}

.iframe-control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #bdc3c7;
    cursor: pointer;
    padding: 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.iframe-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-2px);
}

.iframe-control-btn svg {
    width: 18px;
    height: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    .iframe-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .iframe-header {
        padding: 12px 15px;
    }
    
    .iframe-title {
        font-size: 16px;
    }
    
    .iframe-category {
        font-size: 12px;
    }
    
    .iframe-controls {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .iframe-control-btn {
        padding: 8px;
    }
    
    .iframe-error {
        padding: 20px;
    }
    
    .iframe-error h4 {
        font-size: 20px;
    }
    
    .iframe-error .error-message {
        font-size: 14px;
    }
}

/* Fullscreen */
.iframe-overlay:fullscreen {
    border-radius: 0;
}

.iframe-overlay:fullscreen .iframe-container {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

/* Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Body class when iframe is playing */
body.iframe-playing {
    overflow: hidden;
}

/* Picture-in-Picture support */
.iframe-overlay.pip-mode {
    width: 400px;
    height: 225px;
    top: auto;
    left: auto;
    bottom: 20px;
    right: 20px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.iframe-overlay.pip-mode .iframe-container {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.iframe-overlay.pip-mode .iframe-header,
.iframe-overlay.pip-mode .iframe-controls {
    display: none;
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .iframe-container {
        background: #0f0f0f;
    }
    
    .iframe-header,
    .iframe-controls {
        background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
        border-color: #2d2d2d;
    }
}