/* Product Video Styling */
.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: all 0.3s ease;
}

.video-wrapper:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

/* Responsive aspect ratio for video containers */
.video-wrapper .video-placeholder {
    aspect-ratio: 9/16; /* Vertical aspect ratio for TikTok */
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    min-height: 600px;
}

.video-wrapper .tiktok-embed {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    height: 700px !important;
    min-height: 700px;
    max-width: 600px;
}

.video-wrapper .instagram-media {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    height: auto;
    min-height: 500px;
}

/* Placeholder styling */
.video-placeholder {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px dashed #cbd5e1;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.video-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.video-placeholder:hover::before {
    left: 100%;
}

.video-placeholder:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-color: #64748b;
    transform: translateY(-1px);
}

/* TikTok embed styling */
.tiktok-embed {
    border: none !important;
    border-radius: 8px !important;
    background: #000;
    min-height: 700px;
    height: 700px !important;
    max-height: 700px;
    max-width: 600px;
    width: 100%;
}

.tiktok-embed section {
    border-radius: 8px;
}

/* Instagram embed styling */
.instagram-media {
    border: none !important;
    border-radius: 8px !important;
    background: #fff;
    min-height: 500px;
    height: auto !important;
    margin: 0 !important;
    max-width: 100% !important;
}

/* Loading state */
.video-wrapper.loading {
    opacity: 0.7;
    pointer-events: none;
}

.video-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #f3f3f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

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

/* Mobile responsiveness */
@media (max-width: 768px) {
    .video-wrapper {
        max-width: 100%;
    }
    
    .video-wrapper .video-placeholder {
        aspect-ratio: 9/16; /* Vertical aspect ratio for mobile */
        min-height: 600px;
    }
    
    .video-wrapper .tiktok-embed {
        min-height: 600px;
        height: 600px !important;
        max-height: 600px;
        width: 100% !important;
        max-width: 500px !important;
    }
    
    .video-wrapper .instagram-media {
        min-height: 400px;
        height: auto !important;
    }
    
    .tiktok-embed {
        min-width: 320px !important;
        max-width: 500px !important;
        width: 100% !important;
    }
    
    .instagram-media {
        max-width: 100% !important;
    }
    
    /* Mobile video toggle functionality */
    .video-section-title::after {
        display: inline-block;
    }
    
    /* Hide video section completely by default */
    .video-section {
        margin-bottom: 0 !important;
    }
    
    .video-grid {
        display: none !important;
        height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all 0.4s ease;
    }
    
    .video-grid.show {
        display: grid !important;
        height: auto;
        opacity: 1;
        margin-top: 1rem;
    }
    
    /* Ensure no space is taken when hidden */
    .video-section:not(.expanded) {
        margin-bottom: 0;
    }
    
    .video-section.expanded {
        margin-bottom: 2rem;
    }
}

/* Desktop specific styling */
@media (min-width: 769px) {
    .video-wrapper {
        max-width: 600px;
    }
    
    .tiktok-embed {
        max-width: 600px !important;
        min-width: 325px !important;
    }
    
    /* Desktop video toggle functionality - same as mobile */
    .video-section-title::after {
        display: inline-block;
    }
    
    /* Hide video section completely by default */
    .video-section {
        margin-bottom: 0 !important;
    }
    
    .video-grid {
        display: none !important;
        height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all 0.4s ease;
    }
    
    .video-grid.show {
        display: grid !important;
        height: auto;
        opacity: 1;
        margin-top: 1rem;
    }
    
    /* Ensure no space is taken when hidden */
    .video-section:not(.expanded) {
        margin-bottom: 0;
    }
    
    .video-section.expanded {
        margin-bottom: 2rem;
    }
}

/* Grid layout for multiple videos */
.grid.gap-6.md\:grid-cols-2 .video-wrapper {
    max-width: 100%;
}

/* Error state */
.video-wrapper.error .video-placeholder {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
    color: #dc2626;
}

.video-wrapper.error .video-placeholder:hover {
    background: linear-gradient(135deg, #fee2e2 0%, #fca5a5 100%);
}

/* Smooth transitions */
.video-wrapper * {
    transition: all 0.3s ease;
}

/* Hide placeholder when video is loaded */
.video-wrapper.loaded .video-placeholder {
    display: none;
}

/* Ensure proper iframe sizing */
.video-wrapper iframe {
    width: 100% !important;
    height: 100% !important;
    border-radius: 12px;
    border: none;
}

/* Video section title styling */
.video-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-section-title::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 2px;
}

.video-section-title::after {
    content: '▼';
    font-size: 0.8rem;
    margin-left: auto;
    transition: transform 0.3s ease;
    display: none;
}

.video-section-title:hover {
    color: #3b82f6;
}

.video-section-title.collapsed::after {
    transform: rotate(-90deg);
}

.video-section-title.expanded::after {
    transform: rotate(0deg);
}

/* Video grid improvements */
.video-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 1rem;
}

.video-grid.single {
    grid-template-columns: 1fr;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.video-grid.double {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .video-grid.double {
        grid-template-columns: 1fr 1fr;
    }
}