/**
 * Frontend Styles for Shoppable Video Gallery
 */

/* Main Gallery Container */
.shoppable-video-gallery {
    margin: 20px 0;
    clear: both;
}

/* Video Grid */
.svg-video-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Column Layouts */
.svg-columns-1 .svg-video-item {
    flex: 0 0 100%;
    max-width: 100%;
}

.svg-columns-2 .svg-video-item {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
}

.svg-columns-3 .svg-video-item {
    flex: 0 0 calc(33.333% - 14px);
    max-width: calc(33.333% - 14px);
}

.svg-columns-4 .svg-video-item {
    flex: 0 0 calc(25% - 15px);
    max-width: calc(25% - 15px);
}

.svg-columns-5 .svg-video-item {
    flex: 0 0 calc(20% - 16px);
    max-width: calc(20% - 16px);
}

.svg-columns-6 .svg-video-item {
    flex: 0 0 calc(16.666% - 17px);
    max-width: calc(16.666% - 17px);
}

/* Video Item */
.svg-video-item {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.svg-video-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Video Container */
.svg-video-container {
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
}

.svg-video-container::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

/* Video Embed */
.svg-video-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.svg-video-embed iframe,
.svg-video-embed video {
    width: 100%;
    height: 100%;
    border: none;
}

/* Video File */
.svg-video-file {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video Fallback */
.svg-video-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-decoration: none;
    transition: background 0.3s ease;
}

.svg-video-fallback:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    color: #fff;
    text-decoration: none;
}

.svg-play-button {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.svg-video-url {
    font-size: 12px;
    opacity: 0.8;
    text-align: center;
    padding: 0 10px;
    word-break: break-all;
}

/* Video Info */
.svg-video-info {
    padding: 15px;
}

.svg-video-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
}

/* Product Info */
.svg-product-info {
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 15px;
}

.svg-product-name {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: #555;
}

.svg-product-price {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 700;
    color: #2c5aa0;
}

.svg-product-price .woocommerce-Price-amount {
    font-weight: 700;
}

.svg-product-price del {
    opacity: 0.6;
    margin-right: 5px;
}

/* Product Button */
.svg-product-button {
    display: inline-block;
    padding: 10px 16px;
    background: #2c5aa0;
    color: #fff !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.3s ease;
    border: none;
}

.svg-product-button:hover {
    background: #1e3f73;
    color: #fff !important;
    text-decoration: none;
}

.svg-product-button:focus {
    outline: 2px solid #2c5aa0;
    outline-offset: 2px;
}

/* Loading States */
.svg-video-item.loading {
    opacity: 0.7;
}

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

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

/* Responsive Design */
@media (max-width: 1024px) {
    .svg-columns-5 .svg-video-item,
    .svg-columns-6 .svg-video-item {
        flex: 0 0 calc(25% - 15px);
        max-width: calc(25% - 15px);
    }
}

@media (max-width: 768px) {
    .svg-video-grid {
        gap: 15px;
    }
    
    .svg-columns-3 .svg-video-item,
    .svg-columns-4 .svg-video-item,
    .svg-columns-5 .svg-video-item,
    .svg-columns-6 .svg-video-item {
        flex: 0 0 calc(50% - 7.5px);
        max-width: calc(50% - 7.5px);
    }
    
    .svg-video-info {
        padding: 12px;
    }
    
    .svg-video-title {
        font-size: 15px;
    }
    
    .svg-product-name {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .svg-video-grid {
        gap: 10px;
    }
    
    .svg-columns-2 .svg-video-item,
    .svg-columns-3 .svg-video-item,
    .svg-columns-4 .svg-video-item,
    .svg-columns-5 .svg-video-item,
    .svg-columns-6 .svg-video-item {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .svg-video-info {
        padding: 10px;
    }
    
    .svg-video-title {
        font-size: 14px;
    }
    
    .svg-product-button {
        width: 100%;
        text-align: center;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .svg-video-item {
        background: #2c2c2c;
        color: #fff;
    }
    
    .svg-video-title {
        color: #fff;
    }
    
    .svg-product-name {
        color: #ccc;
    }
    
    .svg-product-info {
        border-top-color: #444;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .svg-video-item {
        border: 2px solid #000;
    }
    
    .svg-product-button {
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .svg-video-item {
        transition: none;
    }
    
    .svg-video-item:hover {
        transform: none;
    }
    
    .svg-video-container.loading::after {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .shoppable-video-gallery {
        display: none;
    }
}

/* Focus Styles for Accessibility */
.svg-video-item:focus-within {
    outline: 2px solid #2c5aa0;
    outline-offset: 2px;
}

.svg-video-embed iframe:focus {
    outline: 2px solid #2c5aa0;
    outline-offset: -2px;
}

/* Custom Scrollbar for Video Containers */
.svg-video-container::-webkit-scrollbar {
    width: 8px;
}

.svg-video-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.svg-video-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.svg-video-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}