/**
 * Tunu Video Player - Frontend Styles
 * Responsive video player styling
 */

/* Video Container */
.tunu-video-container {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #000;
}

/* Video Player Styles */
.tunu-video-player {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
    border-radius: 8px;
}

.tunu-video-player:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* HLS Player Specific */
.tunu-hls-player {
    background: #000;
}

/* Iframe Player Styles */
.tunu-iframe-player {
    width: 100%;
    border: none;
    border-radius: 8px;
    background: #000;
}

/* Logo/Watermark Styles */
.tunu-logo {
    position: absolute;
    z-index: 10;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.tunu-logo img {
    max-width: 150px;
    max-height: 80px;
    height: auto;
    width: auto;
}

.tunu-logo-top-left {
    top: 15px;
    left: 15px;
}

.tunu-logo-top-right {
    top: 15px;
    right: 15px;
}

.tunu-logo-bottom-left {
    bottom: 15px;
    left: 15px;
}

.tunu-logo-bottom-right {
    bottom: 15px;
    right: 15px;
}

/* Logo Size Variations */
.tunu-logo.size-small img {
    max-width: 80px;
    max-height: 40px;
}

.tunu-logo.size-medium img {
    max-width: 120px;
    max-height: 60px;
}

.tunu-logo.size-large img {
    max-width: 200px;
    max-height: 100px;
}

/* Hover Effects */
.tunu-video-container:hover .tunu-logo {
    opacity: 1;
}

/* Loading State */
.tunu-video-loading {
    position: relative;
}

.tunu-video-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 20;
}

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

/* Error State */
.tunu-video-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-align: center;
    padding: 20px;
}

.tunu-video-error::before {
    content: '⚠️';
    font-size: 24px;
    margin-right: 10px;
}

/* Custom Controls (if needed) */
.tunu-custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 15;
}

.tunu-video-container:hover .tunu-custom-controls {
    opacity: 1;
}

.tunu-control-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.tunu-play-button,
.tunu-volume-button,
.tunu-fullscreen-button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.tunu-play-button:hover,
.tunu-volume-button:hover,
.tunu-fullscreen-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.tunu-progress-container {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.tunu-progress-bar {
    height: 100%;
    background: #007cba;
    border-radius: 3px;
    transition: width 0.1s ease;
}

.tunu-time-display {
    font-size: 12px;
    font-family: monospace;
    min-width: 80px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tunu-video-container {
        border-radius: 4px;
    }
    
    .tunu-logo {
        opacity: 1;
    }
    
    .tunu-logo img {
        max-width: 80px;
        max-height: 40px;
    }
    
    .tunu-logo-top-left,
    .tunu-logo-top-right {
        top: 10px;
    }
    
    .tunu-logo-top-left,
    .tunu-logo-bottom-left {
        left: 10px;
    }
    
    .tunu-logo-top-right,
    .tunu-logo-bottom-right {
        right: 10px;
    }
    
    .tunu-logo-bottom-left,
    .tunu-logo-bottom-right {
        bottom: 10px;
    }
    
    .tunu-custom-controls {
        padding: 10px;
    }
    
    .tunu-control-bar {
        gap: 8px;
    }
    
    .tunu-time-display {
        min-width: 60px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .tunu-video-container {
        border-radius: 0;
    }
    
    .tunu-logo img {
        max-width: 60px;
        max-height: 30px;
    }
    
    .tunu-custom-controls {
        padding: 8px;
    }
    
    .tunu-control-bar {
        gap: 6px;
    }
    
    .tunu-play-button,
    .tunu-volume-button,
    .tunu-fullscreen-button {
        padding: 6px;
    }
    
    .tunu-progress-container {
        height: 4px;
    }
}

/* Color Scheme Variations */
.tunu-theme-dark .tunu-video-container {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tunu-theme-light .tunu-video-container {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tunu-theme-custom .tunu-progress-bar {
    background: var(--tunu-primary-color, #007cba);
}

.tunu-theme-custom .tunu-video-player:focus {
    outline-color: var(--tunu-primary-color, #007cba);
}

/* Player Skin Variations */
.tunu-skin-minimal .tunu-video-container {
    box-shadow: none;
    border-radius: 0;
}

.tunu-skin-minimal .tunu-logo {
    opacity: 0.6;
}

.tunu-skin-classic .tunu-video-container {
    border: 2px solid #ddd;
    border-radius: 0;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.tunu-skin-modern .tunu-video-container {
    border-radius: 16px;
    overflow: hidden;
}

/* Accessibility Improvements */
.tunu-video-player[aria-label] {
    /* Screen reader support */
}

.tunu-control-bar button[aria-label] {
    /* Button accessibility */
}

/* Print Styles */
@media print {
    .tunu-video-container {
        border: 2px solid #000;
        background: #f5f5f5;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 200px;
    }
    
    .tunu-video-player,
    .tunu-iframe-player {
        display: none;
    }
    
    .tunu-video-container::after {
        content: 'Video Player (not available in print)';
        font-family: Arial, sans-serif;
        font-size: 14px;
        color: #666;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .tunu-video-container {
        border: 2px solid currentColor;
    }
    
    .tunu-logo {
        opacity: 1;
    }
    
    .tunu-progress-bar {
        background: currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .tunu-logo,
    .tunu-custom-controls,
    .tunu-progress-bar {
        transition: none;
    }
    
    .tunu-video-loading::after {
        animation: none;
        border: 3px solid currentColor;
        border-radius: 0;
    }
}

/* Focus Visible Support */
.tunu-video-player:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.tunu-control-bar button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Fullscreen Styles */
.tunu-video-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border-radius: 0;
}

.tunu-video-container.fullscreen .tunu-video-player,
.tunu-video-container.fullscreen .tunu-iframe-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Lazy Loading */
.tunu-video-player[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tunu-video-player[loading="lazy"].loaded {
    opacity: 1;
}
