/* ==============================
   Shoppable Videos & Reels
   TikTok/Instagram Reels Style
   ============================== */

/* --- Thumbnail Slider (horizontal scroll) --- */
.svr-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

.svr-thumbnail-slider {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.svr-thumbnails-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: var(--svr-gap, 15px);
    margin-bottom: 20px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
    flex: 1;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    .svr-thumbnails-grid {
        justify-content: center;
    }
}

.svr-thumbnails-grid::-webkit-scrollbar {
    display: none;
}

.svr-thumbnail-item {
    flex: 0 0 calc((100% - (var(--svr-cols-desktop, 4) - 1) * var(--svr-gap, 15px)) / var(--svr-cols-desktop, 4));
    max-width: 220px;
    scroll-snap-align: start;
    aspect-ratio: 9 / 16;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background-color: #1a1a2e;
    min-height: 140px;
}

@media (max-width: 1024px) {
    .svr-thumbnail-item {
        flex: 0 0 calc((100% - (var(--svr-cols-tablet, 3) - 1) * var(--svr-gap, 15px)) / var(--svr-cols-tablet, 3));
    }
}

@media (max-width: 768px) {
    .svr-thumbnail-item {
        flex: 0 0 calc((100% - (var(--svr-cols-mobile, 2) - 1) * var(--svr-gap, 15px)) / var(--svr-cols-mobile, 2));
    }
}

@media (max-width: 480px) {
    .svr-thumbnail-item {
        aspect-ratio: 3 / 4;
        min-height: 140px;
        border-radius: 8px;
    }
}

.svr-thumbnails-grid[data-shape="square"] .svr-thumbnail-item {
    aspect-ratio: 1 / 1;
}

.svr-thumbnails-grid[data-shape="landscape"] .svr-thumbnail-item {
    aspect-ratio: 16 / 9;
}

.svr-thumbnail-item:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.svr-thumb-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.5);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255,255,255,0.3);
    transition: transform 0.2s;
    z-index: 2;
    color: white;
}

.svr-thumb-play svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.svr-thumbnail-item:hover .svr-thumb-play {
    transform: translate(-50%, -50%) scale(1.1);
}

.svr-thumb-title {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 24px 10px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    color: white;
    font-size: 13px;
    font-weight: 600;
    z-index: 2;
}

/* --- Slider Arrows --- */
.svr-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: #222;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    pointer-events: none;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.svr-thumbnail-slider:hover .svr-slider-arrow,
.svr-slider-arrow:focus {
    opacity: 1;
    pointer-events: auto;
}

.svr-slider-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.svr-slider-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.svr-slider-prev {
    left: -22px;
    padding-top: 2px;
}

.svr-slider-next {
    right: -22px;
    padding-top: 2px;
}

@media (max-width: 768px) {
    .svr-slider-arrow {
        width: 36px;
        height: 36px;
        font-size: 22px;
        opacity: 1;
        pointer-events: auto;
        background: rgba(255,255,255,0.9);
        box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    }
    .svr-slider-prev {
        left: 6px;
    }
    .svr-slider-next {
        right: 6px;
    }
}

/* --- Fullscreen Popup --- */
.svr-fullscreen-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

@media (max-width: 768px) {
    .svr-fullscreen-popup {
        align-items: flex-start;
    }
}

/* --- Close Button --- */
.svr-close-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    z-index: 100001;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

.svr-close-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* --- Progress Bar (Instagram Stories style) --- */
.svr-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 100001;
    display: flex;
    gap: 4px;
    padding: 8px 8px 0;
    box-sizing: border-box;
}

.svr-progress-segment {
    flex: 1;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.svr-progress-segment .svr-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 2px;
    transition: width 0.1s linear;
}

.svr-progress-segment.active .svr-progress-fill {
    width: 100%;
}

.svr-progress-segment.visited .svr-progress-fill {
    width: 100%;
    background: rgba(255,255,255,0.5);
}

/* --- Navigation Buttons --- */
.svr-nav-buttons {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100000;
}

@media (max-width: 480px) {
    .svr-nav-buttons {
        display: none;
    }
}

.svr-nav-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.svr-nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.svr-nav-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* --- Reels Container (TikTok-style vertical scroll) --- */
.svr-reels-container {
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: calc(90vh - 40px);
    position: relative;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    border-radius: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.svr-reels-container::-webkit-scrollbar {
    display: none;
}

@media (max-width: 768px) {
    .svr-reels-container {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        width: 100%;
        border-radius: 0;
        align-self: stretch;
    }
}

/* --- Video Slide --- */
.svr-video-slide {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 0 0 100%;
    scroll-snap-align: start;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    overflow: hidden;
}

.svr-video-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.svr-video-wrapper video,
.svr-video-wrapper iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* --- Mute/Unmute Button (top-right of video) --- */
.svr-mute-btn-top {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 30;
    background: rgba(0,0,0,0.4);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.svr-mute-btn-top:hover {
    background: rgba(0,0,0,0.6);
}

.svr-mute-btn-top svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* --- Bottom Overlay (TikTok style) --- */
.svr-overlay-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 80px 16px 140px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
    z-index: 10;
    color: white;
}

.svr-overlay-bottom h3 {
    margin: 0 0 4px 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.svr-overlay-bottom .svr-username {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    margin-bottom: 4px;
}

/* --- Play/Pause Overlay --- */
.svr-play-pause-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: rgba(0,0,0,0.45);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
}

.svr-play-pause-overlay svg {
    width: 34px;
    height: 34px;
    fill: currentColor;
}

.svr-play-pause-overlay.visible {
    opacity: 1;
}

/* --- Products Carousel (full-width product list) --- */
.svr-products-carousel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 12px 12px;
    box-sizing: border-box;
    background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.6) 70%, transparent 100%);
    pointer-events: none;
    max-height: 45%;
    overflow-y: auto;
}

.svr-products-carousel::-webkit-scrollbar {
    width: 3px;
}

.svr-products-carousel::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.svr-products-carousel > * {
    pointer-events: auto;
}

/* --- Product Card (full width, white style) --- */
.svr-product-card {
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    text-decoration: none;
    color: #333;
    position: relative;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.15s;
}

.svr-product-card .svr-card-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.svr-product-card:active {
    transform: scale(0.98);
}

.svr-link-card {
    justify-content: center;
    text-align: center;
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.15);
}

.svr-product-card img {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.svr-product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.svr-product-info h4 {
    margin: 0 0 2px 0;
    font-size: 13px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.svr-link-card .svr-product-info h4 {
    color: #fff;
    font-size: 14px;
}

.svr-product-info .svr-price-wrap {
    font-size: 14px;
    color: #e53935;
    font-weight: 700;
    margin-bottom: 6px;
}

.svr-link-card .svr-product-info span {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
}

/* --- Buy Now Button (full width, edge to edge) --- */
.svr-add-to-cart-btn {
    background: #ff3b30;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 12px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: block;
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: background 0.2s;
    line-height: 1.3;
    margin-top: 4px;
}

.svr-add-to-cart-btn:hover {
    background: #e0352b;
}

.svr-view-product-btn {
    background: #f0f0f0;
    color: #333;
}

.svr-view-product-btn:hover {
    background: #e0e0e0;
}

/* --- Loading Spinner --- */
.svr-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.svr-loading::after {
    content: '';
    display: block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: svr-spin 0.7s linear infinite;
}

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