/* Frontend Styles for Advanced Video Player */

/* YouTube and Vimeo iframe styling */
.avp-youtube-player,
.avp-vimeo-player {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
}

.avp-video-player {
    position: relative;
    display: inline-block;
    max-width: 100%;
    background: var(--background-color, #000);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.avp-video-player.responsive {
    width: 100%;
    height: auto;
}

/* Video Element */
.avp-video {
    width: 100%;
    height: auto;
    display: block;
    background: var(--background-color, #000);
}

/* Logo Overlay */
.avp-logo-overlay {
    position: absolute;
    z-index: 10;
    pointer-events: none;
}

.avp-logo-overlay.top-left {
    top: 15px;
    left: 15px;
}

.avp-logo-overlay.top-right {
    top: 15px;
    right: 15px;
}

.avp-logo-overlay.bottom-left {
    bottom: 60px;
    left: 15px;
}

.avp-logo-overlay.bottom-right {
    bottom: 60px;
    right: 15px;
}

.avp-logo-overlay.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.avp-logo {
    display: block;
    max-width: 100%;
    height: auto;
    opacity: var(--logo-opacity, 0.8);
    transition: opacity 0.3s ease;
}

.avp-video-player:hover .avp-logo {
    opacity: calc(var(--logo-opacity, 0.8) * 0.7);
}

/* Custom Controls */
.avp-custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, var(--control-bg, rgba(0,0,0,0.8)));
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.avp-video-player:hover .avp-custom-controls {
    opacity: 1;
}

.avp-video-player.playing .avp-custom-controls {
    opacity: 0;
}

.avp-video-player.playing:hover .avp-custom-controls {
    opacity: 1;
}

/* Control Buttons */
.avp-custom-controls button {
    background: none;
    border: none;
    color: var(--text-color, #fff);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.avp-custom-controls button:hover {
    background: var(--control-hover, rgba(255,255,255,0.2));
    transform: scale(1.1);
}

.avp-custom-controls button:active {
    transform: scale(0.95);
}

.avp-custom-controls button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Progress Container */
.avp-progress-container {
    flex: 1;
    margin: 0 10px;
    position: relative;
}

.avp-progress-bar {
    height: 6px;
    background: var(--progress-bg, rgba(255,255,255,0.3));
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.avp-progress-fill {
    height: 100%;
    background: var(--progress-fill, var(--primary-color, #007cba));
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s ease;
    position: relative;
}

.avp-progress-fill::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--progress-fill, var(--primary-color, #007cba));
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.avp-progress-container:hover .avp-progress-fill::after {
    opacity: 1;
}

.avp-progress-bar:hover {
    height: 8px;
    margin-top: -1px;
}

/* Time Display */
.avp-time-display {
    color: var(--text-color, #fff);
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

/* Volume Control */
.avp-volume {
    position: relative;
}

.avp-volume-slider {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--control-bg, rgba(0,0,0,0.8));
    padding: 10px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.avp-volume:hover .avp-volume-slider {
    opacity: 1;
    pointer-events: all;
}

.avp-volume-slider input {
    writing-mode: bt-lr;
    -webkit-appearance: slider-vertical;
    width: 20px;
    height: 60px;
    background: var(--progress-bg, rgba(255,255,255,0.3));
    outline: none;
}

/* Play/Pause Overlay */
.avp-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: var(--control-bg, rgba(0,0,0,0.8));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
    cursor: pointer;
}

.avp-video-player.paused .avp-play-overlay {
    opacity: 1;
}

.avp-play-overlay svg {
    width: 30px;
    height: 30px;
    fill: var(--text-color, #fff);
    margin-left: 3px;
}

/* Loading State */
.avp-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background-color, #000);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
}

.avp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--progress-bg, rgba(255,255,255,0.3));
    border-top: 3px solid var(--primary-color, #007cba);
    border-radius: 50%;
    animation: avp-spin 1s linear infinite;
}

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

/* Error State */
.avp-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background-color, #000);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-color, #fff);
    text-align: center;
    z-index: 4;
}

.avp-error-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.avp-error-message {
    font-size: 16px;
    margin-bottom: 10px;
}

.avp-error-details {
    font-size: 12px;
    opacity: 0.7;
}

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

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .avp-custom-controls {
        padding: 10px;
        gap: 8px;
    }
    
    .avp-custom-controls button {
        min-width: 35px;
        height: 35px;
        padding: 6px;
    }
    
    .avp-custom-controls button svg {
        width: 16px;
        height: 16px;
    }
    
    .avp-time-display {
        font-size: 10px;
        min-width: 60px;
    }
    
    .avp-progress-bar {
        height: 8px;
    }
    
    .avp-progress-bar:hover {
        height: 10px;
        margin-top: -1px;
    }
    
    .avp-logo-overlay {
        top: 10px;
        left: 10px;
        right: 10px;
        bottom: 50px;
    }
    
    .avp-logo {
        max-width: 80px;
        max-height: 40px;
    }
    
    .avp-play-overlay {
        width: 60px;
        height: 60px;
    }
    
    .avp-play-overlay svg {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .avp-custom-controls {
        padding: 8px;
        gap: 6px;
    }
    
    .avp-custom-controls button {
        min-width: 30px;
        height: 30px;
        padding: 4px;
    }
    
    .avp-time-display {
        font-size: 9px;
        min-width: 50px;
    }
    
    .avp-volume-slider {
        display: none;
    }
}

/* Accessibility */
.avp-video-player:focus-within {
    outline: 2px solid var(--accent-color, #ff6900);
    outline-offset: 2px;
}

.avp-custom-controls button:focus {
    outline: 2px solid var(--accent-color, #ff6900);
    outline-offset: 2px;
}

.avp-progress-bar:focus {
    outline: 2px solid var(--accent-color, #ff6900);
    outline-offset: 2px;
}

/* Screen Reader Only */
.avp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .avp-custom-controls {
        background: rgba(0,0,0,0.95);
    }
    
    .avp-custom-controls button:hover {
        background: rgba(255,255,255,0.3);
    }
    
    .avp-progress-bar {
        border: 1px solid rgba(255,255,255,0.5);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .avp-logo,
    .avp-custom-controls,
    .avp-custom-controls button,
    .avp-progress-fill,
    .avp-play-overlay {
        transition: none;
    }
    
    .avp-spinner {
        animation: none;
        border-top-color: transparent;
    }
}
