/* ============================================================
   Squarefit Superstar Reels – css/reels-section.css  v2.0
   Scope: card enhancements + complete modal redesign.
   Never modifies styles.css. Overrides via ID specificity.
   ============================================================ */

/* ── Body scroll lock when modal open ───────────────────────── */
body.rs-modal-open { overflow: hidden; }

/* ═══════════════════════════════════════════════════════════════
   SKELETON LOADER
═══════════════════════════════════════════════════════════════ */
.rs-skeleton {
  border-radius: 10px;
  overflow: hidden;
  background: rgba(12, 12, 16, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.rs-skeleton-media {
  aspect-ratio: 9 / 16;
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%;
  animation: rs-shimmer 1.4s infinite;
}
.rs-skeleton-caption {
  height: 38px;
  background: linear-gradient(90deg, rgba(255,255,255,.03) 25%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.03) 75%);
  background-size: 200% 100%;
  animation: rs-shimmer 1.4s infinite 0.2s;
}
@keyframes rs-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════════
   CARD ENHANCEMENTS
═══════════════════════════════════════════════════════════════ */

/* Swiper containers — transparent so section background shows through */
.tf-instagram-swiper .swiper-wrapper,
.tf-instagram-swiper .swiper-slide {
  background: transparent !important;
}

/* Glass card — overrides beige background from styles.css */
.tf-instagram-swiper .rs-card {
  position: relative;
  overflow: hidden;
  border-radius: 10px !important;
  background: rgba(12, 12, 16, 0.55) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, .18),
    inset 0 0 0 1px rgba(255, 255, 255, .10);
  transition: box-shadow .22s ease, transform .22s ease;
}
.tf-instagram-swiper .rs-card:hover {
  box-shadow:
    0 8px 32px rgba(0, 0, 0, .28),
    inset 0 0 0 1px rgba(255, 255, 255, .18);
  transform: translateY(-2px);
}

/* Hide old caption bar (replaced by footer overlay) */
.rs-card .reel-caption { display: none !important; }

/* Full-card border-radius on the inner video div */
.rs-card .reel-video {
  border-radius: 10px !important;
}

/* ── Bottom gradient overlay ─────────────────────────────────── */
.rs-gradient-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 48%;
  background: linear-gradient(to top, rgba(0,0,0,.72) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
  border-radius: 0 0 10px 10px;
}

/* ── Play icon overlay ───────────────────────────────────────── */
.rs-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.rs-card:hover .rs-play-overlay { opacity: 1; }
.rs-play-btn {
  width: 54px; height: 54px;
  background: rgba(255,255,255,.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #1a1a1a;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  transition: transform .15s ease;
}
.rs-card:hover .rs-play-btn { transform: scale(1.08); }

/* ── Card footer (badge + caption) ──────────────────────────── */
.rs-card-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 10px 12px 14px;
  z-index: 4;
  pointer-events: none;
  border-radius: 0 0 10px 10px;
}

.rs-card-caption {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0,0,0,.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Error state ─────────────────────────────────────────────── */
.rs-error {
  padding: 40px 20px;
  text-align: center;
  color: #888;
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATION
═══════════════════════════════════════════════════════════════ */
.rs-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30,30,30,.92);
  color: #fff;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 13.5px;
  font-weight: 500;
  z-index: 9999999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .28s ease, transform .28s ease;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-toast.rs-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════════
   REEL MODAL – FULL REDESIGN
   All rules use #reelModal prefix (specificity 1,x,x) to
   override the class-only rules in styles.css without edits.
═══════════════════════════════════════════════════════════════ */

/* ── Backdrop ────────────────────────────────────────────────── */
#reelModal.reel-modal {
  background: rgba(10,10,15,0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
}

/* ── Content card ────────────────────────────────────────────── */
#reelModal .reel-modal-content {
  width: 92%;
  max-width: 960px;
  background: #0f172a;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.06);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
}

/* ── Video-only mode (no product details) ───────────────────── */
#reelModal .reel-modal-content.rs-video-only {
  max-width: 420px;
}
#reelModal .reel-modal-content.rs-video-only .reel-modal-left {
  flex: 1;
  padding: 0;
  border-radius: 0 0 16px 16px;
}
#reelModal .reel-modal-content.rs-video-only .reel-modal-left .portrait-embed,
#reelModal .reel-modal-content.rs-video-only .reel-modal-left .portrait-embed[style*="max-width:560px"] {
  max-width: 100% !important;
  border-radius: 0 0 14px 14px;
}

/* ── Scale-in animation ──────────────────────────────────────── */
#reelModal.rs-modal-open .reel-modal-content {
  animation: rs-modal-in .24s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes rs-modal-in {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── Navigation arrows (float over backdrop, outside the card) ─ */
#reelModal .reel-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
  font-size: 26px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .18s, transform .15s;
  user-select: none;
  padding: 0;
  line-height: 1;
  z-index: 10;
}
#reelModal .reel-modal-nav:hover {
  background: rgba(255,255,255,.28);
  transform: translateY(-50%) scale(1.1);
}
#reelModal .prev-btn { left: 14px; }
#reelModal .next-btn { right: 14px; }

/* ── Modal header bar ────────────────────────────────────────── */
.rs-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}
.rs-counter {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: .04em;
}
.rs-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rs-share-btn {
  width: 34px; height: 34px;
  border: 1px solid #334155;
  border-radius: 50%;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #94a3b8;
  transition: background .18s, color .18s, border-color .18s;
  padding: 0;
  flex-shrink: 0;
}
.rs-share-btn:hover {
  background: var(--Main, #05a081);
  color: #fff;
  border-color: var(--Main, #05a081);
}

/* Inline close button — must stay static inside the bar */
.rs-modal-bar .reel-modal-close {
  position: static !important;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid #334155;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
  background: #0f172a;
  user-select: none;
  flex-shrink: 0;
}
.rs-modal-bar .reel-modal-close:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #f8fafc;
}

/* ── Modal body: dark left + white right ─────────────────────── */
#reelModal .reel-modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
  padding: 0;
  height: auto;
  min-height: 0;
}

/* LEFT — dark cinema panel for the portrait media */
#reelModal .reel-modal-left {
  flex: 0 0 320px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  min-height: 0;
}

/* Portrait container inside the modal left panel */
#reelModal .reel-modal-left .portrait-embed {
  width: 100%;
  max-width: 280px;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}

/* Remove the max-width inline style set by JS for modal context */
#reelModal .reel-modal-left .portrait-embed[style*="max-width:560px"] {
  max-width: 280px !important;
}

/* RIGHT — dark product details panel */
#reelModal .reel-modal-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow-y: auto;
  background: #0f172a;
  border-left: 1px solid #1e293b;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}
#reelModal .reel-modal-right::-webkit-scrollbar { width: 4px; }
#reelModal .reel-modal-right::-webkit-scrollbar-track { background: transparent; }
#reelModal .reel-modal-right::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

/* ── Right panel inner wrapper (scrolls as a unit) ───────────── */
.rm-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  height: 100%;
}

/* ── Thumbnail (product showcase photo) ──────────────────────── */
#reelModal .reel-modal-thumb {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  border: 1px solid #1e293b;
}

/* ── Product name ────────────────────────────────────────────── */
#reelModal .reel-name {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.3;
  margin: 0;
}

/* ── Price row ───────────────────────────────────────────────── */
#reelModal .price-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#reelModal .price-discount {
  font-size: 22px;
  font-weight: 700;
  color: #4ade80;
}
#reelModal .price-original {
  font-size: 15px;
  font-weight: 400;
  color: #475569;
  text-decoration: line-through;
}

/* ── Description ─────────────────────────────────────────────── */
#reelModal .reel-description-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #475569;
  margin: 0 0 6px;
}
#reelModal .description-text {
  font-size: 14px;
  color: #94a3b8;
  line-height: 1.65;
  margin: 0;
  white-space: normal;
  word-break: break-word;
}

/* ── Explore CTA button ──────────────────────────────────────── */
#reelModal .reel-explore-btn {
  display: block;
  margin-top: auto;
  padding: 13px 20px;
  background: var(--Main, #05a081);
  color: #fff;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  text-decoration: none;
  transition: background .18s, transform .12s, box-shadow .18s;
  box-shadow: 0 4px 14px rgba(5,160,129,.3);
}
#reelModal .reel-explore-btn:hover {
  background: #048a6f;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(5,160,129,.42);
  color: #fff;
}

/* ── Keyboard hint ───────────────────────────────────────────── */
.rs-kbd-hint {
  display: none;
  font-size: 11px;
  color: #475569;
  text-align: center;
  padding: 8px 20px 12px;
  flex-shrink: 0;
  margin: 0;
  border-top: 1px solid #1e293b;
  background: #0f172a;
}
@media (hover: hover) and (pointer: fine) {
  .rs-kbd-hint { display: block; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 820px) {
  #reelModal .reel-modal-left { flex: 0 0 260px; }
  #reelModal .reel-modal-content.rs-video-only { max-width: 340px; }
  #reelModal .reel-modal-content.rs-video-only .reel-modal-left { flex: 1; }
}

@media (max-width: 768px) {
  #reelModal .reel-modal-nav  { display: none; }

  #reelModal .reel-modal-content {
    width: 98%;
    border-radius: 16px;
    max-height: 96vh;
  }

  #reelModal .reel-modal-body {
    flex-direction: column;
    overflow-y: auto;
  }

  #reelModal .reel-modal-left {
    flex: 0 0 auto;
    padding: 20px 20px 0;
    justify-content: center;
    background: #000;
  }

  #reelModal .reel-modal-left .portrait-embed,
  #reelModal .reel-modal-left .portrait-embed[style*="max-width:560px"] {
    max-width: 200px !important;
    margin: 0 auto;
  }

  #reelModal .reel-modal-right {
    overflow-y: visible;
  }

  .rm-details {
    padding: 16px;
    gap: 12px;
  }

  .rs-modal-bar { padding: 12px 16px; }
  .rs-card-footer { padding: 8px 10px 12px; }
  .rs-card-caption { font-size: 12px; }
}

@media (max-width: 480px) {
  #reelModal .reel-modal-left .portrait-embed,
  #reelModal .reel-modal-left .portrait-embed[style*="max-width:560px"] {
    max-width: 160px !important;
  }
}
