/* ================================================================
   WC VIDEO STORIES – Frontend v2
================================================================ */

/* ── Story bar (trang shop/danh mục) ─────────────────────────── */
.wcvs-bar {
  width: 100%;
  overflow: hidden;
  padding: 12px 0;
  background: #fff;
  margin-bottom: 16px;
}
.wcvs-bar-inner {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.wcvs-bar-inner::-webkit-scrollbar { display: none; }

.wcvs-story-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.wcvs-story-ring {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  padding: 2.5px;
}
.wcvs-story-ring img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid #fff;
  display: block;
}
.wcvs-story-thumb.wcvs--seen .wcvs-story-ring {
  background: #ccc;
}
.wcvs-story-name {
  font-size: 11px;
  text-align: center;
  max-width: 72px;
  line-height: 1.3;
  color: #333;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ================================================================
   SINGLE PRODUCT WIDGET – nổi góc phải gallery (như Shopee)
================================================================ */
/*
  Widget được render BÊN TRONG .woocommerce-product-gallery bởi PHP.
  Vì gallery có position:relative sẵn → absolute hoạt động.
*/
.wcvs-single-widget {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 100;
  cursor: pointer;
  width: 90px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  background: #000;
  animation: wcvs-pop .35s ease;
  -webkit-tap-highlight-color: transparent;
}
/* Đảm bảo gallery là relative – fallback */
.woocommerce-product-gallery { position: relative !important; }

.wcvs-sw-thumb {
  position: relative;
  width: 90px;
  height: 120px;
  overflow: hidden;
}
.wcvs-sw-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}
.wcvs-single-widget:hover .wcvs-sw-thumb img { transform: scale(1.06); }

.wcvs-sw-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wcvs-sw-play {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9);
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.wcvs-single-widget:hover .wcvs-sw-play { background: rgba(255,255,255,.35); }

.wcvs-sw-badge {
  position: absolute;
  top: 7px;
  left: 7px;
  background: rgba(229,57,53,.9);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.wcvs-sw-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: wcvs-pulse 1.1s infinite;
  display: inline-block;
}
.wcvs-sw-label {
  background: rgba(0,0,0,.78);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  padding: 5px 4px;
  letter-spacing: .2px;
}

/* ================================================================
   VIEWER (fullscreen story player)
================================================================ */
.wcvs-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 999999;
  align-items: center;
  justify-content: center;
}
.wcvs-backdrop.wcvs--open { display: flex; }

.wcvs-viewer {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 100svh;
  max-height: 860px;
  background: #111;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Progress segments */
.wcvs-progress-bar {
  display: flex;
  gap: 3px;
  padding: 10px 10px 0;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
}
.wcvs-prog-seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,.35);
  overflow: hidden;
}
.wcvs-prog-fill {
  height: 100%;
  width: 0;
  background: #fff;
  border-radius: 2px;
  transition: width .1s linear;
}
.wcvs-prog-seg.wcvs--done  .wcvs-prog-fill { width: 100%; transition: none; }
.wcvs-prog-seg.wcvs--active .wcvs-prog-fill { /* width animated by JS */ }

/* Top bar */
.wcvs-top-bar {
  position: absolute;
  top: 20px; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}
.wcvs-prod-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.7);
  flex-shrink: 0;
}
.wcvs-prod-info { flex: 1; overflow: hidden; }
.wcvs-prod-info strong {
  display: block;
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.wcvs-vid-label {
  font-size: 11px;
  color: rgba(255,255,255,.8);
}
.wcvs-close-btn {
  background: rgba(0,0,0,.45);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Video area */
.wcvs-video-wrap {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}
.wcvs-video-wrap video,
.wcvs-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border: none;
}
.wcvs-tap-prev,
.wcvs-tap-next {
  position: absolute;
  top: 0; bottom: 0;
  width: 35%;
  z-index: 5;
}
.wcvs-tap-prev { left: 0; }
.wcvs-tap-next { right: 0; }

/* Play overlay */
.wcvs-play-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.25);
}
.wcvs-play-overlay.wcvs--show { display: flex; }
.wcvs-play-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mute button */
.wcvs-mute-btn {
  position: absolute;
  bottom: 160px;
  right: 14px;
  z-index: 10;
  background: rgba(0,0,0,.5);
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Product panel */
.wcvs-product-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
}
.wcvs-mini-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.wcvs-mini-img {
  width: 46px; height: 46px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,.3);
}
.wcvs-mini-info { flex: 1; overflow: hidden; }
.wcvs-mini-name {
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wcvs-mini-price {
  color: #ffcc00;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}
.wcvs-buy-btn {
  background: #ee4d2d;
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Bottom sheet */
.wcvs-product-sheet {
  position: absolute;
  bottom: -100%;
  left: 0; right: 0;
  max-height: 72%;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 10px 16px 20px;
  overflow-y: auto;
  transition: bottom .35s cubic-bezier(.4,0,.2,1);
  z-index: 20;
}
.wcvs-product-sheet.wcvs--open { bottom: 0; }
.wcvs-sheet-handle {
  width: 40px; height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 0 auto 14px;
}
/* Sheet content */
.wcvs-sheet-product-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.wcvs-sheet-img {
  width: 72px; height: 72px;
  border-radius: 8px;
  object-fit: cover;
}
.wcvs-sheet-info { flex: 1; }
.wcvs-sheet-price { font-size: 18px; font-weight: 700; color: #ee4d2d; }
.wcvs-sheet-name  { font-size: 13px; color: #333; margin-top: 4px; }
.wcvs-sheet-stock { font-size: 12px; color: #4caf50; margin-top: 4px; }
.wcvs-sheet-stock.wcvs--oos { color: #999; }
.wcvs-sheet-stats { font-size: 12px; color: #888; margin-bottom: 10px; }

/* Variation attrs */
.wcvs-attr-block { margin-bottom: 12px; }
.wcvs-attr-label { font-size: 12px; color: #555; margin-bottom: 6px; }
.wcvs-attr-options { display: flex; flex-wrap: wrap; gap: 6px; }
.wcvs-attr-option {
  padding: 5px 12px;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.wcvs-attr-option.wcvs--selected {
  border-color: #ee4d2d;
  background: #fff5f3;
  color: #ee4d2d;
}
.wcvs-attr-option.wcvs--oos { opacity: .4; cursor: not-allowed; text-decoration: line-through; }

/* Qty row */
.wcvs-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.wcvs-qty-label { font-size: 13px; color: #333; }
.wcvs-qty-ctrl { display: flex; align-items: center; gap: 8px; }
.wcvs-qty-btn {
  width: 30px; height: 30px;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wcvs-qty-btn:disabled { opacity: .4; cursor: not-allowed; }
.wcvs-qty-val { font-size: 14px; font-weight: 600; min-width: 24px; text-align: center; }

/* Sheet action buttons */
.wcvs-sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.wcvs-sheet-cart-btn,
.wcvs-sheet-buy-btn {
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.wcvs-sheet-cart-btn { background: #fff1ee; color: #ee4d2d; border: 1.5px solid #ee4d2d; }
.wcvs-sheet-buy-btn  { background: #ee4d2d; color: #fff; }
.wcvs-sheet-cart-btn:disabled,
.wcvs-sheet-buy-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Skeleton */
.wcvs-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: wcvs-shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes wcvs-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Toast */
.wcvs-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  z-index: 9999999;
  white-space: nowrap;
}
.wcvs-toast.wcvs--show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Animations */
@keyframes wcvs-pop {
  from { opacity: 0; transform: scale(.8); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes wcvs-pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.5; transform:scale(.7); }
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .wcvs-viewer { border-radius: 0; max-height: 100svh; }
  .wcvs-single-widget { bottom: 10px; right: 10px; width: 80px; }
  .wcvs-sw-thumb { height: 108px; }
}
