/* Sukham Shoppable Reels — Frontend Styles
   All rules scoped under .ssr-root to avoid theme conflicts. */

.ssr-root {
  --ssr-primary: var(--wd-primary-color, var(--e-global-color-primary, #6c3dff));
  --ssr-text: var(--wd-text-color, var(--e-global-color-text, #ffffff));
  --ssr-ring: var(--wd-primary-color, var(--e-global-color-primary, #6c3dff));
  --ssr-radius: var(--wd-brd-radius, 12px);
  --ssr-card-w: 160px;
  --ssr-card-h: 285px; /* 9:16 ratio */
  color: inherit;
  font-family: inherit;
  line-height: inherit;
}

/* =========================================================
   Base reset for all plugin elements
   ========================================================= */
.ssr-root *,
.ssr-root *::before,
.ssr-root *::after {
  box-sizing: border-box;
}
.ssr-root img,
.ssr-root video {
  display: block;
  max-width: 100%;
}
.ssr-root button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
}
.ssr-root [hidden] {
  display: none !important;
}

/* =========================================================
   CAROUSEL
   ========================================================= */
.ssr-carousel-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 8px 0;
}

.ssr-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 4px 12px;
}
.ssr-carousel::-webkit-scrollbar { display: none; }

.ssr-carousel-item {
  scroll-snap-align: start;
  flex: 0 0 var(--ssr-card-w);
}

/* =========================================================
   REEL CARD (shared by carousel + feed)
   ========================================================= */
.ssr-reel-card,
.ssr-feed-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9/16;
  border-radius: var(--ssr-radius);
  overflow: hidden;
  background: #111;
  outline-offset: 3px;
}
.ssr-reel-card:focus-visible,
.ssr-feed-card:focus-visible {
  outline: 3px solid var(--ssr-primary);
}

.ssr-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s;
}
.ssr-reel-card .ssr-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Gradient overlay */
.ssr-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.1) 50%, transparent 100%);
  pointer-events: none;
}
[data-overlay="solid"] .ssr-overlay  { background: rgba(0,0,0,0.4); }
[data-overlay="none"]  .ssr-overlay  { display: none; }

/* Play icon */
.ssr-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.9);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  transition: opacity 0.2s;
  pointer-events: none;
}
.ssr-reel-card:hover .ssr-play-icon,
.ssr-feed-card:hover .ssr-play-icon { opacity: 0.7; }

/* Badge */
.ssr-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--ssr-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
}

/* Product mini card */
.ssr-product-mini {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  padding: 6px 8px;
  pointer-events: none;
}
.ssr-product-mini img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.ssr-product-mini-info {
  overflow: hidden;
}
.ssr-product-mini-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ssr-product-mini-price {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}

/* Carousel arrows */
.ssr-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10;
  transition: background 0.2s, opacity 0.2s;
  opacity: 0;
}
.ssr-carousel-wrap:hover .ssr-carousel-arrow { opacity: 1; }
.ssr-arrow-prev { left: 6px; }
.ssr-arrow-next { right: 6px; }
.ssr-carousel-arrow:hover { background: #fff; }
@media (max-width: 767px) { .ssr-carousel-arrow { display: none; } }

/* =========================================================
   STORIES
   ========================================================= */
.ssr-stories-wrap {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 8px 4px 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ssr-stories-wrap::-webkit-scrollbar { display: none; }

.ssr-story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ssr-story-btn {
  position: relative;
  width: var(--ssr-story-size, 80px);
  height: var(--ssr-story-size, 80px);
  border-radius: 50%;
  padding: 3px;
  outline-offset: 3px;
}
.ssr-story-btn:focus-visible { outline: 3px solid var(--ssr-primary); }

.ssr-story-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ssr-ring), #ff6b6b 50%, #ffd700);
  padding: 2px;
}

.ssr-story-thumb {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  z-index: 1;
}

.ssr-story-label {
  font-size: 11px;
  text-align: center;
  max-width: var(--ssr-story-size, 80px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

/* =========================================================
   FEED
   ========================================================= */
.ssr-feed-wrap {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(var(--ssr-feed-cols, 4), 1fr);
}
@media (max-width: 900px) {
  .ssr-feed-wrap { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .ssr-feed-wrap { grid-template-columns: repeat(2, 1fr); }
}
.ssr-feed-item { width: 100%; }
.ssr-feed-card { width: 100%; }

/* =========================================================
   MODAL
   ========================================================= */
.ssr-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.ssr-modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: all;
  visibility: visible;
}

.ssr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
  opacity: 0;
  transition: opacity 0.3s;
}
.ssr-modal[aria-hidden="false"] .ssr-modal-backdrop { opacity: 1; }

.ssr-modal-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 420px;
  margin: 0 auto;
}

/* Progress bar */
.ssr-modal-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.2);
  z-index: 10;
}
.ssr-modal-progress-bar {
  height: 100%;
  background: var(--ssr-primary);
  width: 0;
  transition: width 0.25s linear;
}

/* Top controls */
.ssr-modal-top-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 10px;
  z-index: 20;
}
.ssr-modal-close,
.ssr-modal-mute {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.ssr-modal-close:hover,
.ssr-modal-mute:hover { background: rgba(0,0,0,0.8); }

/* Nav arrows */
.ssr-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: background 0.2s;
}
.ssr-modal-nav:hover { background: rgba(255,255,255,0.3); }
.ssr-modal-prev { left: 12px; }
.ssr-modal-next { right: 12px; }
@media (max-width: 480px) {
  .ssr-modal-nav { display: none; }
}

/* Video area */
.ssr-modal-video-area {
  position: relative;
  width: 100%;
  aspect-ratio: 9/16;
  max-height: 75vh;
  background: #000;
  border-radius: var(--ssr-radius);
  overflow: hidden;
  z-index: 5;
}
.ssr-modal-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tap overlay */
.ssr-modal-tap-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.ssr-modal-tap-overlay.visible { opacity: 1; }
.ssr-tap-play-icon { color: rgba(255,255,255,0.8); }

/* Product drawer */
.ssr-modal-product-drawer {
  width: 100%;
  padding: 12px 16px 6px;
  z-index: 10;
}

/* Products toggle */
.ssr-modal-products-toggle {
  width: 100%;
  padding: 0 16px 12px;
  z-index: 10;
}
.ssr-products-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.ssr-products-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.ssr-products-list[aria-hidden="true"] { display: none; }

/* =========================================================
   PRODUCT CARD (modal drawer)
   ========================================================= */
.ssr-product-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 10px 12px;
}
.ssr-product-card-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.ssr-product-card-info {
  flex: 1;
  overflow: hidden;
}
.ssr-product-card-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ssr-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ssr-product-card-name:hover { text-decoration: underline; }
.ssr-product-card-price {
  font-size: 13px;
  color: var(--ssr-text);
  margin-top: 2px;
}
.ssr-product-card-rating { margin-top: 2px; }
.ssr-product-card-price ins,
.ssr-product-card-price bdi,
.ssr-product-card-price .amount,
.ssr-product-card-rating,
.ssr-product-card-rating .star-rating {
  color: inherit;
}

.ssr-product-card-actions .button,
.ssr-product-card-actions button.button,
.ssr-product-card-actions a.button {
  font-family: inherit;
}

.ssr-atc-btn,
.ssr-cta-btn {
  flex-shrink: 0;
  background: var(--ssr-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ssr-atc-btn:hover,
.ssr-cta-btn:hover { opacity: 0.88; }
.ssr-atc-btn:active,
.ssr-cta-btn:active { transform: scale(0.97); }
.ssr-atc-btn.ssr-loading { opacity: 0.6; pointer-events: none; }
.ssr-atc-btn.ssr-added   { background: #22c55e; }

/* Button variants */
.button-style-outline .ssr-atc-btn,
.button-style-outline .ssr-cta-btn {
  background: transparent !important;
  border: 2px solid var(--ssr-primary);
  color: var(--ssr-primary);
}
.button-style-text .ssr-atc-btn,
.button-style-text .ssr-cta-btn {
  background: transparent !important;
  color: var(--ssr-primary);
  text-decoration: underline;
}

/* =========================================================
   Responsive columns for carousel
   ========================================================= */
@media (min-width: 1025px) {
  .ssr-carousel-item {
    flex-basis: calc((100% - (var(--cols-desktop, 5) - 1) * 12px) / var(--cols-desktop, 5));
  }
}
@media (min-width: 768px) and (max-width: 1024px) {
  .ssr-carousel-item {
    flex-basis: calc((100% - (var(--cols-tablet, 3) - 1) * 12px) / var(--cols-tablet, 3));
  }
}
@media (max-width: 767px) {
  .ssr-carousel-item {
    flex-basis: calc((100% - (var(--cols-mobile, 2) - 1) * 12px) / var(--cols-mobile, 2));
  }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .ssr-modal-backdrop,
  .ssr-modal-progress-bar,
  .ssr-atc-btn,
  .ssr-cta-btn,
  .ssr-poster { transition: none !important; }
}

/* =========================================================
   Utilities
   ========================================================= */
.ssr-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
