/* ============================================================
   Shoppable Reel Carousel  —  Frontend v2.1
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

/* ── Full-width breakout ─────────────────────────────────── */
.irc-wrap {
    width: 100vw;
    position: relative;
    left: 50%;
    margin-left: -50vw;
    background: #fff;
    overflow: hidden;
}
.irc-outer {
    position: relative;
    padding: 20px 56px 28px;
    overflow: hidden;
}

/* ── Track ───────────────────────────────────────────────── */
.irc-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Disable pointer events on track itself so only slides are clickable */
    scroll-behavior: auto; /* JS handles smooth scroll */
}
.irc-track::-webkit-scrollbar { display: none; }

/* ── Slides ─────────────────────────────────────────────── */
.irc-slide {
    flex: 0 0 calc((100% - 56px) / 5);
    scroll-snap-align: start;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 14px rgba(0,0,0,.10);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform .22s ease, box-shadow .22s ease;
    user-select: none; /* prevent text-select while clicking */
}
.irc-slide:hover { transform: translateY(-4px); box-shadow: 0 10px 30px rgba(0,0,0,.15); }

/* ── Card media (9:16) ───────────────────────────────────── */
.irc-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    background: #111;
    flex-shrink: 0;
}

/*
 * Thumbnail image — ALWAYS VISIBLE as a permanent backdrop.
 * This means the video plays on top and when it loops back to
 * frame 0 there is never a grey/black flash — the image shows through.
 */
.irc-thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 1;
}
.irc-thumb-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg,#1a1a2e 0%,#16213e 60%,#0f3460 100%);
    z-index: 1;
}

/*
 * Preview video — sits on top of the thumbnail (z-index 2).
 * opacity is set to 1 by JS only after `canplay` fires,
 * ensuring the user never sees the loading grey frame.
 * We also manually seek to 0 just before the last frame so
 * the loop is seamless (no browser-gap flash).
 */
.irc-preview-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    opacity: 0;          /* revealed by JS once ready */
    pointer-events: none;
}

/* Play button overlay */
.irc-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    background: rgba(0,0,0,.18);
    transition: background .2s;
}
.irc-slide:hover .irc-play-overlay { background: rgba(0,0,0,.30); }
.irc-play-btn {
    width: 54px; height: 54px;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,.30);
    transition: transform .18s, background .18s;
    padding: 0;
}
.irc-slide:hover .irc-play-btn { transform: scale(1.1); background: #fff; }
.irc-play-btn svg { width: 20px; height: 20px; margin-left: 3px; }

/* ── Mini product (below card) ───────────────────────────── */
.irc-mini-product {
    padding: 12px 14px 14px;
    display: flex; flex-direction: column; gap: 7px;
    flex: 1; background: #fff;
}
.irc-mini-name {
    font-size: 13px; font-weight: 600; color: #111;
    margin: 0; line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont,'Segoe UI',sans-serif;
}
.irc-mini-pricing { display:flex; align-items:center; flex-wrap:wrap; gap:5px; min-height:20px; }
.irc-sale-price  { font-size:15px; font-weight:700; color:#E1306C;
    font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
.irc-reg-price   { font-size:12px; color:#999; text-decoration:line-through;
    font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
.irc-norm-price  { font-size:15px; font-weight:700; color:#111;
    font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
.irc-badge {
    background:#ff5a1f; color:#fff; font-size:10px; font-weight:700;
    padding:2px 7px; border-radius:20px; letter-spacing:.3px;
    font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}
.irc-view-btn {
    display:block; background:#111; color:#fff !important;
    text-align:center; padding:10px; border-radius:8px;
    font-size:13px; font-weight:600; text-decoration:none !important;
    letter-spacing:.3px; transition:background .18s;
    font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    margin-top:auto;
}
.irc-view-btn:hover { background:#333 !important; }

/* ── Navigation arrows ───────────────────────────────────── */
/*
 * Arrows are positioned over the video area only (not over the
 * product card). top: 20px + half the video height.
 * Video height = (track_width / 5) * 16/9  ≈  use 38% of wrapper.
 */
.irc-arrow {
    position: absolute;
    top: calc(20px + ((100% - 112px) / 5 * 16 / 9 / 2));
    transform: translateY(-50%);
    z-index: 10;
    width: 42px; height: 42px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 14px rgba(0,0,0,.20);
    transition: box-shadow .18s, transform .18s;
    padding: 0; flex-shrink: 0;
}
.irc-arrow:hover { box-shadow: 0 4px 22px rgba(0,0,0,.30); transform: translateY(-50%) scale(1.08); }
.irc-arrow svg { width:18px; height:18px; color:#222; pointer-events:none; }
.irc-prev { left: 8px; }
.irc-next { right: 8px; }
.irc-arrow[disabled] { opacity:.2; pointer-events:none; }

/* ============================================================
   MODAL
   ============================================================ */
.irc-modal {
    display: none; position: fixed; inset: 0;
    z-index: 999999; align-items: center; justify-content: center;
}
.irc-modal.open { display: flex; }

.irc-modal-bg {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}

.irc-modal-box {
    position: relative; z-index: 1;
    display: flex; align-items: stretch;
    border-radius: 20px; overflow: hidden;
    box-shadow: 0 30px 90px rgba(0,0,0,.6);
    max-height: 90vh;
    max-width: 820px;
    width: calc(100% - 32px);
}

.irc-modal-close {
    position: absolute; top: 12px; right: 14px; z-index: 10;
    background: rgba(0,0,0,.5); border: none; color: #fff;
    font-size: 24px; width: 38px; height: 38px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    line-height: 1; transition: background .18s; font-family: sans-serif;
}
.irc-modal-close:hover { background: rgba(0,0,0,.75); }

/* Video column */
.irc-modal-video-col {
    height: 90vh;
    width: calc(90vh * 9 / 16);
    flex-shrink: 0;
    background: #000;
}
#irc-modal-video {
    width: 100%; height: 100%;
    object-fit: cover; display: block; background: #000;
}

/* Product column */
.irc-modal-product-col {
    width: 280px; min-width: 240px;
    background: #fff;
    display: flex; flex-direction: column;
    overflow-y: auto;
    padding: 24px 20px 20px;
    gap: 14px; flex-shrink: 0;
}
.irc-modal-product-col:empty { display: none; }

.irc-modal-prod-img {
    width: 100%; aspect-ratio: 1;
    object-fit: cover; border-radius: 12px; display: block;
}
.irc-no-img { background: #f0f0f0; border-radius: 12px; }

.irc-modal-prod-name {
    font-size: 15px; font-weight: 700; color: #111;
    line-height: 1.35; margin: 0;
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}

.irc-modal-pricing { display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.irc-modal-price-sale { font-size:20px; font-weight:800; color:#E1306C;
    font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
.irc-modal-price-reg  { font-size:14px; color:#999; text-decoration:line-through;
    font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
.irc-modal-price-norm { font-size:20px; font-weight:800; color:#111;
    font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
.irc-modal-badge {
    background:#ff5a1f; color:#fff; font-size:11px; font-weight:700;
    padding:3px 9px; border-radius:20px;
    font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}

/* ── Variation swatches ─────────────────────────────────── */
.irc-variants-label {
    font-size: 12px; font-weight: 600; color: #555; text-transform: uppercase;
    letter-spacing: .5px;
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}
.irc-variants {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.irc-swatch {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 4px 6px 5px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    min-width: 54px; max-width: 72px;
    overflow: hidden;
}
.irc-swatch:hover { border-color: #888; }
.irc-swatch.selected { border-color: #111; box-shadow: 0 0 0 2px #111; }
.irc-swatch img {
    width: 44px; height: 44px;
    object-fit: cover; border-radius: 6px; display: block;
}
.irc-swatch-txt {
    width: 44px; height: 44px;
    background: #f0f0f0; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #444;
}
.irc-swatch-label {
    font-size: 10px; color: #444; text-align: center;
    line-height: 1.2; word-break: break-word;
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    max-width: 64px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.irc-select-hint {
    font-size: 12px; color: #999; margin: 0;
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}

/* ── Add to Cart — black ────────────────────────────────── */
.irc-modal-cart-btn, a.irc-modal-cart-btn { color: #fff !important; text-decoration: none !important;
    display: block; width: 100%;
    background: #111;               /* ← black */
    color: #fff;
    border: none; border-radius: 10px;
    padding: 13px; font-size: 15px; font-weight: 700;
    cursor: pointer; text-align: center;
    transition: background .18s, transform .15s;
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    letter-spacing: .3px;
}
.irc-modal-cart-btn:hover:not([disabled]) { background: #333 !important; transform: scale(1.02); color: #fff !important; text-decoration: none !important; }
.irc-modal-cart-btn[disabled] { opacity: .4; cursor: not-allowed; }
.irc-modal-cart-btn.loading   { opacity: .65; pointer-events: none; }
.irc-modal-cart-btn.success   { background: #2e7d32; }

.irc-modal-view-btn {
    display: block; width: 100%;
    background: #fff; color: #111;
    border: 2px solid #111; border-radius: 10px;
    padding: 11px; font-size: 14px; font-weight: 600;
    cursor: pointer; text-align: center; text-decoration: none;
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    transition: background .18s;
}
.irc-modal-view-btn:hover { background: #f5f5f5; color: #111; }

/* Toast */
.irc-toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #111; color: #fff;
    padding: 12px 22px; border-radius: 30px;
    font-size: 14px; font-weight: 600;
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    z-index: 9999999;
    transition: transform .3s, opacity .3s;
    opacity: 0; pointer-events: none; white-space: nowrap;
}
.irc-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .irc-slide { flex: 0 0 calc((100% - 28px) / 3); }
    .irc-outer { padding: 16px 48px 24px; }
    .irc-modal-product-col { width: 240px; }
}
@media (max-width: 600px) {
    .irc-slide  { flex: 0 0 100%; }
    .irc-outer  { padding: 12px 42px 20px; }
    .irc-arrow  { width: 34px; height: 34px; }
    .irc-arrow svg { width: 15px; height: 15px; }

    .irc-modal-box  { flex-direction: column; max-height: 95vh; border-radius: 16px; width: calc(100% - 20px); }
    .irc-modal-video-col { height: calc(55vw * 16/9); width: 100%; max-height: 55vh; }
    .irc-modal-product-col { width: 100%; padding: 14px 16px; }
}
