/* ── Wrap & Track ─────────────────────────────────────────── */
.srg-wrap {
    position: relative;
    max-width: 100%;
}

.srg-mode-grid .srg-track {
    display: grid;
    grid-template-columns: repeat(var(--srg-cols, 4), 1fr);
    gap: var(--srg-gap, 12px);
}

.srg-mode-carousel {
    display: flex;
    align-items: center;
    gap: 8px;
}

.srg-mode-carousel .srg-track {
    display: flex;
    gap: var(--srg-gap, 12px);
    overflow: hidden;
    scroll-behavior: smooth;
    flex: 1;
}

.srg-mode-carousel .srg-card {
    flex: 0 0 calc((100% - (var(--srg-cvis, 4) - 1) * var(--srg-gap, 12px)) / var(--srg-cvis, 4));
}

.srg-nav {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #fff;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
}

.srg-nav:hover { background: #f0f0f0; transform: scale(1.08); }
.srg-nav:disabled { opacity: 0.35; pointer-events: none; }

/* ── Card ─────────────────────────────────────────────────── */
.srg-card {
    position: relative;
    border-radius: var(--srg-radius, 12px);
    overflow: hidden;
    cursor: pointer;
    background: #0d0d0d;
    outline: none;
}

.srg-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: var(--srg-ratio, 9/16);
    overflow: hidden;
}

.srg-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.srg-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

video.srg-preview { object-fit: cover; }

/* object-fit has no effect on iframes, so YouTube/Vimeo's own player would
   otherwise letterbox (fit-within, with black bars) instead of filling a
   tall 9:16 card. Oversizing the iframe and clipping via the card's
   overflow:hidden simulates cover-fit instead. */
iframe.srg-preview {
    inset: auto;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    transform: translate(-50%, -50%);
}

.srg-preview.is-active { opacity: 1; }

.srg-card-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.1) 45%, transparent 100%);
    z-index: 2;
    pointer-events: none;
}

.srg-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.3s;
}

.srg-preview.is-active ~ .srg-play-icon,
.srg-preview.is-active + .srg-card-gradient + .srg-play-icon {
    opacity: 0;
}

.srg-play-icon svg { fill: #fff; }

.srg-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    background: #111;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.srg-invalid-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    background: rgba(200,30,30,0.85);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.srg-card-invalid .srg-play-icon { display: none; }

.srg-shop-dot {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 3;
    background: rgba(255,255,255,0.95);
    color: #111;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── Popup: overlay / shell ───────────────────────────────── */
.srg-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.srg-popup-overlay.is-open {
    display: flex;
    animation: srg-fade-in 0.25s ease forwards;
}

.srg-popup-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    max-width: 95vw;
    max-height: 95vh;
}

@keyframes srg-fade-in { from { opacity: 0; } to { opacity: 1; } }

.srg-popup-shell {
    position: relative;
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: srg-popup-in 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
    box-shadow: 0 24px 80px rgba(0,0,0,0.35);
}

@keyframes srg-popup-in {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.srg-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    background: rgba(0,0,0,0.08);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 20px;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.srg-popup-close:hover { background: #111; color: #fff; }

.srg-popup-close-outside {
    position: static;
    background: rgba(255,255,255,0.15) !important;
}

.srg-popup-close-outside:hover { background: #fff !important; }

.srg-reel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.35);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s;
}

.srg-reel-nav:hover { background: rgba(0,0,0,0.6); }
.srg-reel-prev { left: 12px; }
.srg-reel-next { right: 12px; }

/* ── Popup: body ──────────────────────────────────────────── */
.srg-popup-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.srg-popup-video {
    flex: 1 1 55%;
    background: #000;
    position: relative;
    min-height: 320px;
}

.srg-popup-video iframe,
.srg-popup-video video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: contain;
}

.srg-mute-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 6;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(20,30,40,0.75);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s;
}

.srg-mute-btn:hover { background: rgba(20,30,40,0.95); }

.srg-popup-product {
    flex: 1 1 45%;
    overflow: hidden;
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
}

.srg-prod-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.srg-prod-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.srg-popup-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.srg-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: #111;
    border-radius: 50%;
    animation: srg-spin 0.8s linear infinite;
}

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

/* ── Product panel content ────────────────────────────────── */
.srg-prod-main-img {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #f4f4f4;
    flex-shrink: 0;
    text-align: center;
}

.srg-prod-main-img img {
    width: 100%;
    height: auto;
    max-height: 380px;
    min-height: 160px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.srg-prod-thumbs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.srg-prod-thumbs img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 7px;
    cursor: pointer;
    flex-shrink: 0;
    border: 2px solid #e0e0e0;
}

.srg-prod-thumbs img:hover,
.srg-prod-thumbs img.active { border-color: #111; }

.srg-prod-name {
    font-size: 19px;
    font-weight: 700;
    color: #111;
    line-height: 1.3;
    margin: 0;
}

.srg-prod-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #888;
}

.srg-prod-price {
    font-size: 18px;
    font-weight: 700;
    color: #111;
}

.srg-prod-price del { opacity: 0.5; font-weight: 400; margin-right: 6px; }
.srg-prod-price ins { text-decoration: none; }

.srg-prod-sku { font-size: 12px; color: #999; }

.srg-prod-stock {
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    padding: 3px 10px;
    border-radius: 999px;
}

.srg-prod-stock.instock { color: #1e7d34; background: #e8f7ec; }
.srg-prod-stock.outstock { color: #b02a2a; background: #fbeaea; }

.srg-prod-desc {
    font-size: 13.5px;
    line-height: 1.65;
    color: #555;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.srg-prod-desc.srg-expanded {
    display: block;
    -webkit-line-clamp: unset;
}

.srg-prod-read-more {
    font-size: 12.5px;
    font-weight: 700;
    color: #111;
    cursor: pointer;
    text-decoration: underline;
    margin: 2px 0 0;
    display: inline-block;
    background: none;
    border: none;
    padding: 0;
}

.srg-prod-attr { display: flex; flex-direction: column; gap: 6px; }
.srg-prod-attr label { font-size: 12.5px; font-weight: 700; color: #333; }
.srg-prod-attr-options { display: flex; flex-wrap: wrap; gap: 6px; }

.srg-attr-btn {
    padding: 6px 12px;
    border: 1.5px solid #ddd;
    border-radius: 999px;
    background: #fff;
    font-size: 12.5px;
    cursor: pointer;
}

.srg-attr-btn.active { border-color: #111; background: #111; color: #fff; }
.srg-attr-btn:disabled { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }

.srg-prod-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
}

.srg-prod-actions-row {
    display: flex;
    gap: 8px;
}

.srg-prod-actions-row .srg-btn-atc,
.srg-prod-actions-row .srg-btn-buy-now {
    flex: 1;
}

.srg-btn-atc,
.srg-btn-buy-now {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    text-decoration: none;
}

.srg-btn-atc:hover:not(:disabled),
.srg-btn-buy-now:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.srg-btn-atc:disabled,
.srg-btn-buy-now:disabled { opacity: 0.6; cursor: not-allowed; }
.srg-btn-atc.success { background: #27ae60 !important; }

.srg-btn-view {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px;
    background: #fff;
    color: #333;
    border: 1.5px solid #ddd;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.srg-btn-view:hover { background: #f5f5f5; }

.srg-cart-notif {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999999;
    background: #111;
    color: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: srg-slide-up 0.3s ease forwards;
}

@keyframes srg-slide-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.srg-cart-notif a { color: #9fd6ff; text-decoration: underline; }

body.srg-locked { overflow: hidden; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1100px) {
    .srg-mode-grid .srg-track { grid-template-columns: repeat(var(--srg-cols-tablet, 3), 1fr); }
}

@media (max-width: 768px) {
    .srg-mode-grid .srg-track { grid-template-columns: repeat(var(--srg-cols-mobile, 2), 1fr); }

    .srg-popup-body { flex-direction: column; overflow-y: auto; }

    .srg-popup-video {
        flex: 0 0 auto;
        min-height: unset;
        aspect-ratio: 16/9;
        width: 100%;
    }

    .srg-popup-video iframe,
    .srg-popup-video video {
        position: relative;
        width: 100%;
        height: 100%;
    }

    .srg-popup-shell { max-height: 95vh; border-radius: 14px; }
    .srg-prod-main-img img { max-height: 260px; }
    .srg-reel-nav { width: 34px; height: 34px; }
}
