/**
 * Shoppable Videos — CSS
 * Performance: will-change শুধু animate হওয়া element এ, minimal repaints
 */

/* ============================================================
   Wrapper & Grid
   ============================================================ */
.sv-wrapper {
    width: 100%;
    box-sizing: border-box;
    padding: 20px 0;
}

.sv-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

/* ============================================================
   Video Card
   ============================================================ */
.sv-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 9 / 16;
    cursor: pointer;
    background: #1a1a1a;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.sv-card:focus-visible {
    box-shadow: 0 0 0 3px #e63946;
}

/* ============================================================
   View Count
   ============================================================ */
.sv-views {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
    line-height: 1;
}

.sv-eye-icon {
    display: flex;
    align-items: center;
}

/* ============================================================
   Video Container
   ============================================================ */
.sv-video-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.sv-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* YouTube Thumbnail */
.sv-yt-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sv-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* ============================================================
   Bottom Product Bar (Card)
   ============================================================ */
.sv-product-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
    z-index: 10;
    pointer-events: none;
}

.sv-product-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,0.4);
}

.sv-product-name {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ============================================================
   Modal Overlay
   ============================================================ */
.sv-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sv-modal[hidden] {
    display: none;
}

.sv-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

/* ============================================================
   Modal Content
   ============================================================ */
.sv-modal-content {
    position: relative;
    width: min(400px, 95vw);
    height: min(780px, 95vh);
    border-radius: 16px;
    overflow: hidden;
    background: #111;
    display: flex;
    flex-direction: column;
    z-index: 1;
    will-change: transform;
}

/* ============================================================
   Modal Buttons (Close, Mute, Share)
   ============================================================ */
.sv-btn-close,
.sv-btn-mute,
.sv-btn-share {
    position: absolute;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 0;
    transition: background 0.2s ease;
}

.sv-btn-close:hover,
.sv-btn-mute:hover,
.sv-btn-share:hover {
    background: rgba(0, 0, 0, 0.8);
}

.sv-btn-close {
    top: 12px;
    right: 12px;
}

.sv-btn-mute {
    top: 12px;
    right: 58px;
}

.sv-share-buttons {
    position: absolute;
    right: 12px;
    bottom: 180px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
}

.sv-btn-share {
    position: static;
}

.sv-btn-whatsapp {
    background: rgba(37, 211, 102, 0.85);
}

.sv-btn-whatsapp:hover {
    background: rgba(37, 211, 102, 1);
}

/* ============================================================
   Arrow Navigation
   ============================================================ */
.sv-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 0;
    transition: background 0.2s ease, opacity 0.2s ease;
    margin-top: -60px; /* product panel উপরে যাওয়ার জন্য */
}

.sv-arrow:hover {
    background: rgba(255, 255, 255, 0.35);
}

.sv-arrow-prev {
    left: 10px;
}

.sv-arrow-next {
    right: 10px;
}

.sv-arrow[hidden] {
    display: none;
}

/* ============================================================
   Modal Video Area
   ============================================================ */
.sv-modal-video-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

.sv-modal-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sv-modal-video-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ============================================================
   Modal Product Panel
   ============================================================ */
.sv-modal-product {
    position: relative;
    background: #fff;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
    min-height: 110px;
    overflow: hidden;
}

/* Product Info Row */
.sv-product-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 14px;
}

.sv-product-info-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.sv-modal-product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #eee;
}

.sv-product-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sv-modal-product-name {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sv-modal-product-price {
    font-size: 13px;
    color: #e63946;
    font-weight: 500;
}

.sv-modal-product-price ins {
    text-decoration: none;
}

/* Add to Cart Button */
.sv-btn-add-to-cart {
    background: #e63946;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.1s ease;
}

.sv-btn-add-to-cart:hover {
    background: #c1121f;
}

.sv-btn-add-to-cart:active {
    transform: scale(0.97);
}

.sv-btn-add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ============================================================
   Size Selector Panel
   ============================================================ */
.sv-size-panel {
    padding: 14px 14px;
}

.sv-size-panel[hidden] {
    display: none;
}

.sv-variations-wrap {
    margin-top: 12px;
}

.sv-variation-group {
    margin-bottom: 12px;
}

.sv-variation-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.sv-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sv-option-btn {
    padding: 7px 12px;
    border-radius: 8px;
    border: 1.5px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.sv-option-btn:hover {
    border-color: #e63946;
    color: #e63946;
}

.sv-option-btn.sv-selected {
    background: #e63946;
    border-color: #e63946;
    color: #fff;
}

/* Size Action Buttons */
.sv-size-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.sv-btn-cancel {
    background: #f0f0f0;
    color: #555;
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.sv-btn-cancel:hover {
    background: #e0e0e0;
}

.sv-btn-done {
    background: #e63946;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.sv-btn-done:hover {
    background: #c1121f;
}

.sv-btn-done:active {
    transform: scale(0.97);
}

.sv-btn-done:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ============================================================
   Loading Spinner
   ============================================================ */
.sv-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    z-index: 30;
}

.sv-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sv-spin 0.7s linear infinite;
}

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

/* ============================================================
   Toast Notification
   ============================================================ */
.sv-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: #222;
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    z-index: 999999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.sv-toast.sv-toast-show {
    opacity: 1;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .sv-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .sv-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 0 10px;
    }

    .sv-modal-content {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }

    .sv-share-buttons {
        bottom: 200px;
    }

    .sv-arrow {
        margin-top: -80px;
    }
}

/* ============================================================
   Product Page — Floating Mini Player
   ============================================================ */

.sv-pv-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99998;
}

/* ── Mini Player ── */
.sv-pv-mini {
    position: relative;
    width: 190px;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    cursor: pointer;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}

.sv-pv-mini.sv-pv-mini--visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Controls bar (top) */
.sv-pv-mini-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    padding: 5px 6px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent);
}

.sv-pv-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.18);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
    flex-shrink: 0;
}
.sv-pv-btn:hover { background: rgba(255,255,255,0.35); }

.sv-pv-btn-close-mini { background: rgba(210,40,40,0.75); }
.sv-pv-btn-close-mini:hover { background: rgba(210,40,40,1); }

/* Video wrap */
.sv-pv-mini-video-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #000;
    overflow: hidden;
}

.sv-pv-mini-thumb,
#sv-pv-mini-vid {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sv-pv-mini-play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    pointer-events: none;
}

/* Product bar (bottom) */
.sv-pv-mini-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 9px;
    background: #fff;
}

.sv-pv-mini-bar-thumb {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #eee;
}

.sv-pv-mini-bar-name {
    font-size: 11px;
    font-weight: 500;
    color: #111;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ── Full Modal ── */
.sv-pv-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sv-pv-modal[hidden] { display: none; }

.sv-pv-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    cursor: pointer;
}

.sv-pv-modal-inner {
    position: relative;
    width: min(400px, 95vw);
    height: min(780px, 95vh);
    border-radius: 16px;
    overflow: hidden;
    background: #111;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* Modal video */
.sv-pv-modal-video {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}
.sv-pv-modal-video video,
.sv-pv-modal-video iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: none;
}

/* Modal buttons */
.sv-pv-modal-btn {
    position: absolute;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.55);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 0;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.sv-pv-modal-btn:hover { background: rgba(0,0,0,0.8); }

.sv-pv-modal-btn-close { top: 12px; right: 12px; }
.sv-pv-modal-btn-mute  { top: 12px; right: 58px; }

/* Share */
.sv-pv-modal-share {
    position: absolute;
    right: 12px;
    bottom: 175px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
}

.sv-pv-share-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.55);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.sv-pv-share-btn:hover { background: rgba(0,0,0,0.8); }

.sv-pv-whatsapp { background: rgba(37,211,102,0.85); }
.sv-pv-whatsapp:hover { background: rgba(37,211,102,1); }

/* Product panel */
.sv-pv-modal-product {
    background: #fff;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
    overflow: hidden;
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .sv-pv-wrapper { bottom: 16px; right: 10px; }
    .sv-pv-mini { width: 155px; }
    .sv-pv-modal-inner { width: 100vw; height: 100dvh; border-radius: 0; }
    .sv-pv-modal-share { bottom: 195px; }
}
