/* ============================================================
   VIDEO / PRODUCT POPUP MODAL — EdgeThatGuy Theme
   Instant "Wix-like" content popup for video posts & products.
   ⚠️  BUILDER: After editing, run: cd agent-dev-server && node scripts/rebuild-theme.cjs
   ============================================================ */

/* ─── Overlay ─── */
.vmodal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9800;
  align-items: flex-start;
  justify-content: center;
  /* No backdrop blur: keeps iframe/video playback smoother while modal is open. */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 40px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.vmodal-overlay.active { display: flex; }

/* ─── Modal Box ─── */
.vmodal-box {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  max-width: 920px;
  width: 100%;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  position: relative;
  animation: vmodalFastIn 0.16s ease-out;
  will-change: opacity, transform;
  margin: auto 0;
}


@keyframes vmodalFastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Close Button ─── */
.vmodal-close {
  position: absolute;
  top: -48px;
  right: 0;
  background: rgba(255,255,255,0.08);
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--ease), background var(--ease);
  z-index: 10;
}
.vmodal-close:hover {
  color: var(--text);
  background: rgba(255,255,255,0.16);
}
.vmodal-close svg { width: 20px; height: 20px; }

/* ─── Video Player Area (Posts) ─── */
.vmodal-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  position: relative;
}
/* Multi-video: remove fixed aspect ratio, let each iframe size itself */
.vmodal-player.multi-video {
  aspect-ratio: auto;
  height: auto;
  overflow: visible;
}
.vmodal-player iframe,
.vmodal-player video,
.vmodal-player .video-player-wrap,
.vmodal-player .video-player-wrap iframe {
  width: 100% !important;
  height: 100% !important;
  border: none;
  display: block;
}
.vmodal-player.multi-video iframe {
  height: auto !important;
  aspect-ratio: 16 / 9;
}
.vmodal-player.multi-video iframe + iframe {
  margin-top: 4px;
}
.vmodal-player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── Content Area (below player or beside gallery) ─── */
.vmodal-content {
  padding: 24px 32px 32px;
}

/* Title */
.vmodal-title {
  font-family: var(--font-head);
  font-size: clamp(18px, 2.8vw, 24px);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.3;
}

/* Meta (date · categories) */
.vmodal-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.vmodal-meta a { color: var(--accent); text-decoration: none; }
.vmodal-meta a:hover { text-decoration: underline; }
.vmodal-meta .sep { opacity: 0.4; }

/* ─── Model Info ─── */
.vmodal-model {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.vmodal-model-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
}
.vmodal-model-name {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: color var(--ease);
}
.vmodal-model-name:hover { color: var(--accent); }
.vmodal-model-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Description */
.vmodal-desc {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.vmodal-desc p { margin-bottom: 10px; }

/* ─── Tags ─── */
.vmodal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.vmodal-tag {
  font-size: 11px;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  text-decoration: none;
  transition: background var(--ease), color var(--ease);
}
.vmodal-tag:hover {
  background: rgba(255,255,255,0.1);
  color: var(--accent);
}

/* ─── Comments Section (inside popup) ─── */
.vmodal-comments-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.vmodal-comments-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}
.vmodal-comments-section .edgt-comment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ─── Product Layout (Desktop: side-by-side) ─── */
.vmodal-product-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 0;
}
.vmodal-product-gallery {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px 0 0 0;
  overflow: hidden;
}
.vmodal-product-gallery iframe,
.vmodal-product-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
  display: block;
}
.vmodal-product-info {
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
}
.vmodal-product-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.vmodal-product-price {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 14px;
}
.vmodal-product-price del {
  color: var(--text-muted);
  margin-right: 8px;
  font-size: 18px;
}
.vmodal-product-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
  column-count: 2;
  column-gap: 32px;
  orphans: 3;
  widows: 3;
}
.vmodal-product-desc p {
  margin-bottom: 12px;
}
.vmodal-product-desc *,
.vmodal-product-desc p,
.vmodal-product-desc span,
.vmodal-product-desc div,
.vmodal-product-desc strong,
.vmodal-product-desc em {
  background-color: transparent !important;
  background: transparent !important;
  color: inherit !important;
}
.vmodal-product-desc-section {
  padding: 24px 32px;
}
.vmodal-separator {
  border-top: 1px solid var(--border);
  margin: 0;
}
.vmodal-product-actions { margin-top: auto; }
.vmodal-product-actions .btn-add-to-cart {
  width: 100%;
  justify-content: center;
}
.vmodal-product-actions .edgt-atc-form { margin: 0; }
/* Owner badge */
.vmodal-owned-badge {
  padding: 12px 16px;
  background: rgba(34,197,94,0.1);
  border-radius: var(--radius);
  font-size: 13px;
  color: #22c55e;
  margin-bottom: 12px;
}

/* ─── Loading Skeleton ─── */
.vmodal-skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.03) 25%,
    rgba(255,255,255,0.07) 50%,
    rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: vmodalShimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes vmodalShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Mobile Responsive ─── */
@media (max-width: 768px) {
  .vmodal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .vmodal-box {
    max-width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: vmodalSlideUp 0.18s ease-out;
  }
  .vmodal-close {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 9810;
    background: rgba(0,0,0,0.65);
  }
  .vmodal-close:hover {
    background: rgba(0,0,0,0.8);
  }
  .vmodal-player {
    border-radius: 16px 16px 0 0;
  }
  .vmodal-content {
    padding: 20px 20px 100px;
  }
  /* Product: stack vertically on mobile */
  .vmodal-product-grid {
    grid-template-columns: 1fr;
  }
  .vmodal-product-gallery {
    border-radius: 16px 16px 0 0;
  }
  .vmodal-product-info {
    padding: 20px 20px 8px;
  }
  .vmodal-product-desc-section {
    padding: 16px 20px;
  }
  .vmodal-product-desc {
    column-count: 1;
  }
}

@keyframes vmodalSlideUp {
  from { opacity: 0; transform: translateY(60px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Text Content (post description below excerpt, inside vmodal-content) ─── */
.vmodal-text-content {
  padding: 16px 0 0;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 16px;
}
.vmodal-text-content p { margin-bottom: 10px; }
.vmodal-text-content a { color: var(--accent); }
.vmodal-text-content *,
.vmodal-text-content span,
.vmodal-text-content div {
  background-color: transparent !important;
  background: transparent !important;
  color: inherit !important;
}
/* FIX v2.27 #4: images/figures inside announcement text must be responsive */
.vmodal-text-content img,
.vmodal-text-content figure img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 10px auto;
}
.vmodal-text-content figure {
  margin: 12px 0;
  text-align: center;
}

/* ─── Model info wrapper: ensure name + count stack properly ─── */
.vmodal-model-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ─── Comment / Review Form ─── */
.vmodal-comment-form {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.vmodal-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.vmodal-form-label {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.vmodal-form-user {
  font-size: 12px;
  color: var(--text-muted);
}
.vmodal-comment-input {
  width: 100%;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
  transition: border-color var(--ease);
  box-sizing: border-box;
}
.vmodal-comment-input:focus {
  outline: none;
  border-color: var(--accent);
}
.vmodal-comment-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}
.vmodal-comment-submit {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 24px;
  background: var(--accent);
  color: var(--btn-text-color, #fff);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), opacity var(--ease);
}
.vmodal-comment-submit:hover { opacity: 0.9; }
.vmodal-comment-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Star Rating ─── */
.vmodal-star-rating {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.vmodal-star {
  font-size: 22px;
  cursor: pointer;
  color: var(--border);
  transition: color 0.15s ease;
  user-select: none;
}
.vmodal-star.active { color: #f59e0b; }
.vmodal-star.hover { color: #fbbf24; }

/* ─── Form Notice (non-logged-in or non-purchaser) ─── */
.vmodal-form-notice {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ─── Mobile adjustments for new elements ─── */
@media (max-width: 768px) {
  .vmodal-text-content { padding: 12px 0 0; }
  .vmodal-comment-form { margin-top: 16px; }
}

/* =============================================================
   FIX v2.27: Full popup content — images, embeds, video
   ============================================================= */

/* Hide player shell when post has no video */
.vmodal-no-video {
  display: none !important;
}

/* Images inside post text content */
.vmodal-text-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius, 6px);
  margin: 10px 0;
  display: block;
}

/* Embedded iframes (YouTube, Vimeo, etc.) in text area */
.vmodal-text-content iframe {
  max-width: 100%;
  border-radius: var(--radius, 6px);
  display: block;
  margin: 10px 0;
}

/* Native <video> elements */
.vmodal-text-content video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius, 6px);
  display: block;
  margin: 10px 0;
}

/* WP block embed wrappers */
.vmodal-text-content .wp-block-embed,
.vmodal-text-content .wp-block-image,
.vmodal-text-content figure.wp-block-image {
  max-width: 100%;
  margin: 10px 0;
}
.vmodal-text-content .wp-block-embed__wrapper iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
}


/* v3.50: Release date under popup product price */
.vmodal-product-date{
  margin:-10px 0 22px;
  font-size:13px;
  line-height:1.5;
  color:var(--text-muted);
  letter-spacing:.02em;
}
.vmodal-product-date span{
  color:var(--text);
  font-family:var(--font-head);
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:12px;
}

/* v3.57 — perceived popup speed: show thumbnail while Bunny iframe paints */
.vmodal-player-prethumb {
  background-color: #000;
  background-size: cover;
  background-position: center;
}
.vmodal-player-prethumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.46));
  pointer-events: none;
  z-index: 0;
}
.vmodal-player-prethumb .vmodal-player-loading {
  z-index: 2;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}
.vmodal-play-pulse {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 82%, transparent);
  color: var(--bg-outer, #050505);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 36%, transparent);
  animation: vmodalPulsePlay 1.2s ease-out infinite;
}
@keyframes vmodalPulsePlay {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 36%, transparent); transform: scale(1); }
  70% { box-shadow: 0 0 0 16px rgba(255,255,255,0); transform: scale(1.03); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); transform: scale(1); }
}
.vmodal-frame-loading iframe,
.vmodal-frame-loading video {
  opacity: 0;
}
.vmodal-frame-ready iframe,
.vmodal-frame-ready video {
  opacity: 1;
  transition: opacity .18s ease;
}

/* v3.111 — Product category links directly beneath popup purchase controls */
.vmodal-product-category-links {
  margin-top: 13px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}
.vmodal-product-category-links span { font-weight: 600; color: var(--text); }
.vmodal-product-category-links a { color: var(--accent); text-decoration: none; }
.vmodal-product-category-links a:hover { text-decoration: underline; }

/* v3.112: consistent PPV category typography in guest and signed-in popups. */
.vmodal-product-actions .vmodal-product-category-links,
.vmodal-product-actions .vmodal-product-category-links span,
.vmodal-product-actions .vmodal-product-category-links a {
  font-family: var(--font-body), system-ui, sans-serif !important;
  font-size: 13px !important;
  font-style: normal !important;
  line-height: 1.6 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}
.vmodal-product-actions .vmodal-product-category-links { color: var(--text-muted); }
.vmodal-product-actions .vmodal-product-category-links span { color: var(--text); font-weight: 600; }
.vmodal-product-actions .vmodal-product-category-links a { color: var(--accent) !important; font-weight: 400 !important; text-decoration: none; }
.vmodal-product-actions .vmodal-product-category-links a:hover { text-decoration: underline; }

/* WordPress uses comment-reply-login for logged-out visitors, not comment-reply-link. */
.vmodal-comments-section .edgt-reply-link .comment-reply-login {
  display: inline-block;
  font-family: var(--font-head), sans-serif !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--accent, #bada55) !important;
  padding: 4px 12px;
  border: 1px solid var(--accent, #bada55);
  border-radius: 3px;
  background: transparent;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.vmodal-comments-section .edgt-reply-link .comment-reply-login:hover {
  background: var(--accent, #bada55);
  color: #111 !important;
}
