/* ================================================================
   Content Vault Pro — Overlay v13
   ================================================================ */
:root {
  --cvp-purple:    #6c3fe4;
  --cvp-purple-dk: #5530c0;
  --cvp-purple-lt: #ede9ff;
  --cvp-gold:      #f59e0b;
  --cvp-green:     #16a34a;
  --cvp-red:       #dc2626;
  --cvp-text:      #111827;
  --cvp-muted:     #6b7280;
  --cvp-border:    #e5e7eb;
  --cvp-card-bg:   #f8f7ff;
  --cvp-white:     #ffffff;
  --cvp-ease:      cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Page content blur when locked ─────────────────────── */
body.cvp-locked > *:not(#cvp-overlay-wrap) {
  filter: blur(var(--cvp-blur, 6px));
  -webkit-filter: blur(var(--cvp-blur, 6px));
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Backdrop wrap ──────────────────────────────────────── */
#cvp-overlay-wrap {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483647 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  background: rgba(10,5,30,0.65) !important;
  box-sizing: border-box !important;
  filter: none !important;
  -webkit-filter: none !important;
}

/* ── Main popup card ────────────────────────────────────── */
.cvp-popup {
  background: var(--cvp-white);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(10,5,30,0.3);
  width: 100%;
  max-width: 860px;
  max-height: calc(100svh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cvpPopIn 0.4s var(--cvp-ease) both;
  position: relative;
  z-index: 1;
}
@keyframes cvpPopIn {
  from { opacity:0; transform:scale(0.94) translateY(18px); }
  to   { opacity:1; transform:none; }
}

/* Header */
.cvp-popup-hd {
  background: linear-gradient(135deg,#6c3fe4 0%,#9b5de5 100%);
  padding: 16px 20px 14px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.cvp-popup-icon {
  width:36px; height:36px; background:rgba(255,255,255,0.2);
  border-radius:50%; display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.cvp-popup-icon svg { width:16px; height:16px; stroke:#fff; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.cvp-popup-hd-text { flex:1; min-width:0; }
.cvp-popup-headline { font-size:.95rem; font-weight:800; color:#fff; margin:0 0 2px; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.cvp-popup-subtext  { font-size:.72rem; color:rgba(255,255,255,.82); margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.cvp-popup-login    { font-size:.72rem; color:rgba(255,255,255,.85); white-space:nowrap; flex-shrink:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.cvp-popup-login a  { color:#fff; font-weight:700; text-decoration:underline; }

/* Body / grid */
.cvp-popup-body {
  padding: 18px;
  overflow-y: auto; flex:1;
  scrollbar-width: thin; scrollbar-color: #e0dcf5 transparent;
}
.cvp-popup-body::-webkit-scrollbar { width:4px; }
.cvp-popup-body::-webkit-scrollbar-thumb { background:#d1d5db; border-radius:2px; }

/* Plans row — fills width, each card auto-sized, overflow scrolls */
.cvp-plans-scroll-row {
  display: flex;
  flex-direction: row;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  /* Stretch cards to fill available width evenly */
  align-items: stretch;
  scrollbar-width: thin;
  scrollbar-color: #ddd8ff transparent;
}
.cvp-plans-scroll-row::-webkit-scrollbar { height: 4px; }
.cvp-plans-scroll-row::-webkit-scrollbar-thumb { background: #ddd8ff; border-radius: 2px; }

/* Plan card — width adapts: fills row if ≤2 plans, fixed if more */
.cvp-plan-card {
  flex: 1 0 calc(50% - 7px); /* grow to fill if space available */
  min-width: 220px;
  max-width: 400px;
  background: var(--cvp-card-bg);
  border: 1.5px solid #ddd8ff;
  border-radius: 16px;
  display: flex; flex-direction: column;
  scroll-snap-align: start;
  transition: border-color .2s, box-shadow .18s, transform .15s;
}
.cvp-plan-card:hover { border-color:var(--cvp-purple); box-shadow:0 6px 24px rgba(108,63,228,.16); transform:translateY(-2px); }

.cvp-plan-main { display:flex; align-items:center; gap:11px; padding:12px 14px; min-height:80px; }
.cvp-plan-img  { width:56px; height:56px; border-radius:10px; object-fit:cover; flex-shrink:0; background:#ddd8ff; }
.cvp-plan-info { flex:1; min-width:0; }
.cvp-plan-name { font-size:.84rem; font-weight:700; color:var(--cvp-text); margin:0 0 5px; line-height:1.25; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.cvp-plan-prices { display:flex; align-items:baseline; gap:5px; flex-wrap:wrap; }
.cvp-plan-regular    { font-size:.72rem; color:#9ca3af; text-decoration:line-through; font-weight:400; font-family:-apple-system,sans-serif; }
.cvp-plan-sale       { font-size:.9rem; font-weight:800; color:var(--cvp-red); font-family:-apple-system,sans-serif; }
.cvp-plan-price-only { font-size:.9rem; font-weight:800; color:var(--cvp-purple); font-family:-apple-system,sans-serif; }
.cvp-plan-badge { display:inline-block; background:var(--cvp-gold); color:#fff; font-size:.6rem; font-weight:800; padding:2px 7px; border-radius:100px; }

.cvp-plan-footer { padding:0 14px 14px; display:flex; flex-direction:column; gap:8px; margin-top:auto; }

.cvp-plan-buy {
  display:flex; align-items:center; justify-content:center; gap:6px;
  padding:10px 16px; background:var(--cvp-purple); color:#fff !important;
  text-decoration:none !important; font-size:.82rem; font-weight:700;
  border-radius:100px; box-shadow:0 4px 14px rgba(108,63,228,.32);
  transition:background .16s,transform .12s; border:none; cursor:pointer; width:100%;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.cvp-plan-buy:hover { background:var(--cvp-purple-dk); transform:translateY(-1px); color:#fff !important; }
.cvp-plan-buy svg { width:12px; height:12px; stroke:#fff; fill:none; stroke-width:2.5; stroke-linecap:round; stroke-linejoin:round; }

/* More Info button */
.cvp-info-btn {
  display:flex; align-items:center; justify-content:center; gap:5px;
  padding:7px 14px; background:var(--cvp-purple-lt); color:var(--cvp-purple);
  border:1px solid #c4b5fd; border-radius:100px; cursor:pointer;
  font-size:.72rem; font-weight:600; width:100%;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  transition:background .15s;
}
.cvp-info-btn:hover { background:#ddd8ff; }
.cvp-info-btn svg { width:13px; height:13px; stroke:var(--cvp-purple); fill:none; stroke-width:2; flex-shrink:0; }

/* No plans */
.cvp-no-plans { padding:24px 20px; text-align:center; }
.cvp-no-plans p { font-size:.88rem; color:var(--cvp-muted); margin:0 0 14px; }
.cvp-no-plans a { display:inline-block; padding:11px 28px; background:var(--cvp-purple); color:#fff; border-radius:100px; text-decoration:none; font-weight:700; font-size:.88rem; }

/* Popup footer */
.cvp-popup-footer {
  flex-shrink: 0;
  padding: 10px 18px 14px;
  border-top: 1px solid #f0f0f7;
  display: flex;
  justify-content: center;
}
.cvp-back-home {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--cvp-muted);
  text-decoration: none;
  padding: 7px 18px;
  border-radius: 100px;
  border: 1px solid var(--cvp-border);
  background: #fafafe;
  transition: background .15s, color .15s;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.cvp-back-home:hover { background: var(--cvp-purple-lt); color: var(--cvp-purple); border-color: #c4b5fd; }
.cvp-back-home svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Detail modal (opens on More Info) ──────────────────── */
.cvp-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 2; /* above main popup (same stacking context) */
  background: rgba(10,5,30,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  animation: cvpFadeIn .25s ease both;
}
@keyframes cvpFadeIn { from{opacity:0} to{opacity:1} }

.cvp-detail-inner {
  background: var(--cvp-white);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(10,5,30,0.3);
  width: 100%; max-width: 480px;
  max-height: calc(100svh - 32px);
  /* display:block so sticky children work correctly */
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  animation: cvpSlideUp .32s var(--cvp-ease) both;
}
@keyframes cvpSlideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:none} }

/* Sticky topbar — sticks to top of .cvp-detail-inner scroll container */
.cvp-detail-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--cvp-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px 10px;
  border-bottom: 1px solid #f0f0f7;
  border-radius: 20px 20px 0 0; /* match parent radius */
}
.cvp-detail-topbar-label {
  font-size: .76rem;
  font-weight: 700;
  color: var(--cvp-purple);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cvp-detail-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .12s;
}
.cvp-detail-close:hover { background: #e5e7eb; transform: scale(1.08); }
.cvp-detail-close svg { width:14px; height:14px; stroke:var(--cvp-text); fill:none; stroke-width:2.5; stroke-linecap:round; }

.cvp-detail-img-wrap {
  width: 100%;
  background: #f8f7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  min-height: 180px;
  max-height: 280px;
}
.cvp-detail-img {
  max-width: 100%;
  max-height: 240px;
  width: auto;
  height: auto;
  object-fit: contain;   /* show full image, no cropping */
  display: block;
  border-radius: 10px;
}

.cvp-detail-body { padding:20px 22px 24px; }

.cvp-det-plan-name {
  font-size:.7rem; font-weight:700; color:var(--cvp-purple);
  text-transform:uppercase; letter-spacing:.06em; margin:0 0 4px;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.cvp-det-prod-name {
  font-size:1.15rem; font-weight:800; color:var(--cvp-text);
  margin:0 0 12px; line-height:1.25;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

.cvp-det-price-row {
  display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:16px;
}
.cvp-det-regular { font-size:.85rem; color:#9ca3af; text-decoration:line-through; font-weight:400; font-family:-apple-system,sans-serif; }
.cvp-det-sell    { font-size:1.2rem; font-weight:800; color:var(--cvp-red); font-family:-apple-system,sans-serif; }

.cvp-det-desc {
  font-size:.82rem; color:var(--cvp-muted); line-height:1.65;
  margin:0 0 14px; white-space:pre-line;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

.cvp-det-feats {
  list-style:none; margin:0 0 20px; padding:0;
  display:flex; flex-direction:column; gap:8px;
}
.cvp-det-feats li {
  display:flex; align-items:flex-start; gap:9px;
  font-size:.82rem; color:var(--cvp-text); line-height:1.4;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.cvp-det-feats li::before { content:"✓"; color:var(--cvp-green); font-weight:800; flex-shrink:0; }

.cvp-det-buy-btn {
  display:flex; align-items:center; justify-content:center; gap:8px;
  width:100%; padding:14px 20px;
  background:var(--cvp-purple); color:#fff !important; text-decoration:none !important;
  font-size:.9rem; font-weight:700; border-radius:100px;
  box-shadow:0 4px 16px rgba(108,63,228,.35);
  transition:background .16s,transform .12s;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.cvp-det-buy-btn:hover { background:var(--cvp-purple-dk); transform:translateY(-1px); color:#fff !important; }
.cvp-det-buy-btn svg { width:14px; height:14px; stroke:#fff; fill:none; stroke-width:2.5; stroke-linecap:round; stroke-linejoin:round; }

/* ── Mobile responsive ──────────────────────────────────── */
@media (max-width: 600px) {
  /* Main popup: full-width bottom sheet */
  #cvp-overlay-wrap {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .cvp-popup {
    border-radius: 20px 20px 0 0 !important;
    max-height: 90svh !important;
    max-width: 100% !important;
  }
  .cvp-popup-hd  { padding: 12px 14px 10px; gap: 9px; }
  .cvp-popup-headline { font-size: .82rem; }
  .cvp-popup-subtext  { font-size: .66rem; }
  .cvp-popup-login    { font-size: .66rem; }
  .cvp-popup-body { padding: 10px 10px 12px; }
  /* Mobile: 1 card full popup width */
  .cvp-plans-scroll-row { gap: 10px; padding-bottom: 4px; }
  .cvp-plan-card  { flex: 1 0 calc(100% - 20px); min-width: 0; max-width: 100%; }
  .cvp-plan-main  { min-height: 68px; padding: 9px 10px; gap: 8px; }
  .cvp-plan-img   { width: 42px; height: 42px; border-radius: 7px; }
  .cvp-plan-name  { font-size: .72rem; }
  .cvp-plan-buy   { padding: 8px 10px; font-size: .7rem; gap: 4px; }
  .cvp-info-btn   { font-size: .66rem; padding: 5px 10px; }
  .cvp-back-home  { font-size: .72rem; padding: 6px 14px; }

  /* Detail modal: full screen on mobile */
  .cvp-detail-modal { padding: 0; align-items: flex-end; }
  .cvp-detail-inner  { border-radius: 20px 20px 0 0; max-height: 90svh; max-width: 100%; }
  .cvp-detail-img-wrap { min-height: 140px; max-height: 200px; padding: 12px; }
  .cvp-detail-img { max-height: 180px; }
  .cvp-detail-body { padding: 16px 16px 20px; }
  .cvp-det-prod-name { font-size: 1rem; }
}

/* Tablet */
@media (max-width: 768px) and (min-width: 601px) {
  .cvp-plan-card { flex: 1 0 calc(50% - 7px); min-width: 180px; }
  #cvp-overlay-wrap { padding: 12px !important; }
  .cvp-popup { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cvp-popup, .cvp-detail-inner, .cvp-detail-modal { animation: none; }
}

/* Single plan: fill the full available width, uncapped */
.cvp-plans-scroll-row .cvp-plan-card:only-child {
  flex: 1 0 100%;
  max-width: 100%;
}

/* Logged-in user pill */
.cvp-popup-user{display:flex;align-items:center;gap:8px;flex-shrink:0;}
.cvp-popup-user-avatar{width:30px;height:30px;border-radius:50%;background:rgba(255,255,255,0.25);color:#fff;font-size:.78rem;font-weight:800;display:flex;align-items:center;justify-content:center;flex-shrink:0;text-transform:uppercase;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;border:1.5px solid rgba(255,255,255,0.4);}
.cvp-popup-user-info{display:flex;flex-direction:column;align-items:flex-end;gap:1px;}
.cvp-popup-user-name{font-size:.72rem;font-weight:700;color:#fff;white-space:nowrap;max-width:120px;overflow:hidden;text-overflow:ellipsis;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;}
.cvp-popup-logout{font-size:.64rem;color:rgba(255,255,255,.75);text-decoration:underline;white-space:nowrap;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;transition:color .15s;}
.cvp-popup-logout:hover{color:#fff;}
