/**
 * Product Video Module CSS
 * Mobile-first responsive design for video display on product pages
 */


#product-video-panel .form-wrapper {
    margin-left: 0 !important;
    margin-right: 0 !important;
}





/* Main product video section */
.product-video-section {
    margin: 2rem 0;
    padding: 1rem 0;
    border-top: 1px solid #e4e7ea;
    border-bottom: 1px solid #e4e7ea;
    background: #ffffff;
}

.product-video-wrapper {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
}

/* Video header */
.product-video-header {
    margin-bottom: 1rem;
    text-align: center;
}

.product-video-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #363a41;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}


/* Keyframe animations for emoji icons */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

/* Responsive video embeds */
.video-embed {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

.video-embed iframe,
.video-embed video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Responsive iframe */
.responsive-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

/* Responsive video */
.responsive-video {
    width: 100%;
    height: auto;
    max-width: 100%;
    background: #000;
    border-radius: 8px;
}

/* Loading overlay */
.video-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.loading-spinner {
    text-align: center;
    color: #fff;
}

.loading-spinner .loading-text {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    display: inline-block;
    animation: spin 1s linear infinite;
}

.loading-spinner .rotating {
    animation: rotate 1s linear infinite;
}

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

/* Error overlay */
.video-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(220, 53, 69, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.error-content {
    text-align: center;
    color: #fff;
}

.error-content .error-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.error-content .retry-video {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.error-content .retry-video:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Custom video controls for hosted videos */
.custom-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    padding: 1rem;
    z-index: 5;
}

.controls-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
}

.control-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn span {
    font-size: 1.5rem;
}

/* Progress bar */
.progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    min-width: 50px;
}

.progress-filled {
    height: 100%;
    background: #007bff;
    border-radius: 2px;
    transition: width 0.1s ease;
    width: 0;
}

.time-display {
    font-size: 0.875rem;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

/* Volume controls */
.volume-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-slider {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
}

/* Mobile-first responsive design */

/* Small mobile devices (320px - 480px) */
@media screen and (max-width: 480px) {
    .product-video-section {
        margin: 1rem -15px; /* Extend to screen edges */
        padding: 1rem 15px;
    }

    .product-video-title {
        font-size: 1.25rem;
    }

    .product-video-container {
        border-radius: 0; /* Remove border radius on small screens */
    }

    .custom-video-controls {
        padding: 0.75rem;
    }

    .controls-wrapper {
        gap: 0.5rem;
    }

    .control-btn span {
        font-size: 1.25rem;
    }

    .time-display {
        font-size: 0.75rem;
        min-width: 70px;
    }

    .volume-controls {
        display: none; /* Hide volume controls on very small screens */
    }

    /* Make video full width on mobile */
    .video-embed {
        border-radius: 0;
    }
}

/* Medium mobile devices (481px - 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .product-video-container {
        max-width: 100%;
        margin: 0 auto;
    }

    .volume-slider {
        width: 50px;
    }
}

/* Tablets (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .product-video-container {
        max-width: 700px;
    }

    .product-video-title {
        font-size: 1.75rem;
    }
}

/* Desktop and larger screens (1025px+) */
@media screen and (min-width: 1025px) {
    .product-video-section {
        padding: 2rem 0;
    }

    .product-video-container {
        max-width: 800px;
    }

    .product-video-title {
        font-size: 2rem;
    }

    /* Show larger controls on desktop */
    .control-btn span {
        font-size: 1.75rem;
    }

    .volume-slider {
        width: 80px;
    }
}

/* High DPI displays */
@media only screen and (-webkit-min-device-pixel-ratio: 2),
       only screen and (min-device-pixel-ratio: 2),
       only screen and (min-resolution: 192dpi),
       only screen and (min-resolution: 2dppx) {
    .product-video-container {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .product-video-section {
        background: #1a1a1a;
        border-color: #333;
    }

    .product-video-title {
        color: #e4e7ea;
    }

    .product-video-wrapper {
        background: #1a1a1a;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner .rotating {
        animation: none;
    }

    .progress-filled,
    .control-btn,
    .retry-video {
        transition: none;
    }
}

/* Print styles */
@media print {
    .product-video-section {
        display: none;
    }
}

/* Focus states for accessibility */
.control-btn:focus,
.volume-slider:focus,
.retry-video:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Hover states for interactive elements */
.progress-bar:hover .progress-filled {
    background: #0056b3;
}

.volume-slider:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* YouTube-specific styling */
.youtube-embed .responsive-iframe {
    background: #000;
}

/* Vimeo-specific styling */
.vimeo-embed .responsive-iframe {
    background: #1ab7ea;
}

/* Hosted video specific styling */
.hosted-video-embed video {
    object-fit: cover;
}

/* External video styling */
.external-video-embed .responsive-iframe {
    background: #f8f9fa;
}