/*
 * Vandeto Age Gate — Frontend Overlay
 * Version: 1.0.0
 * Namespace: #vag-overlay — zero leakage into AdForest styles
 * ---------------------------------------------------------------
 * Palette:
 *   --vag-primary  : configurable via PHP (default #ff1700)
 *   #0a0c10        : Abyss (overlay bg)
 *   #0e1118        : Card bg
 *   #f0f2f5        : Text primary
 *   #3a3f4a        : Text muted
 * ---------------------------------------------------------------
 */

/* ── Reset & base ── */
#vag-overlay,
#vag-overlay *,
#vag-overlay *::before,
#vag-overlay *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Overlay shell ── */
#vag-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Poppins', 'Quicksand', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* ── Animated dark backdrop ── */
.vag-backdrop {
  position: absolute;
  inset: -5%;          /* slightly oversized so blur doesn't show edges */
  z-index: 0;
  background-color: #0a0c10;
  background-image:
    radial-gradient(ellipse 60% 50% at 15% 25%, rgba(255, 23, 0, 0.07) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 75%, rgba(255, 194, 32, 0.04) 0%, transparent 70%);
  background-size: 200% 200%;
  animation: vag-bg-drift 14s ease-in-out infinite alternate;
  transition: opacity 0.4s;
}

/* When custom bg image is set */
.vag-backdrop[style*="background-image"] {
  background-blend-mode: overlay;
  filter: blur(14px) brightness(0.12) saturate(0.3);
  transform: scale(1.08);
}

@keyframes vag-bg-drift {
  0%   { background-position: 0%   0%; }
  100% { background-position: 100% 100%; }
}

/* ── Noise texture overlay (pure CSS) ── */
.vag-noise {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* ── Card ── */
.vag-card {
  position: relative;
  z-index: 2;
  background: rgba(13, 16, 24, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 28px;
  padding: 44px 40px 36px;
  max-width: 468px;
  width: calc(100% - 32px);
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 48px 96px rgba(0, 0, 0, 0.75),
    0 16px 32px rgba(0, 0, 0, 0.5);
  animation: vag-card-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

@keyframes vag-card-enter {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Top accent glow line */
.vag-card-glow {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--vag-primary, #ff1700) 50%,
    transparent 100%
  );
  border-radius: 0 0 4px 4px;
  box-shadow: 0 0 18px 3px var(--vag-primary, #ff1700);
  opacity: 0.65;
  pointer-events: none;
}

/* ── Dismiss animation ── */
#vag-overlay.vag-dismissing {
  animation: vag-overlay-out 0.38s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes vag-overlay-out {
  0%   { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

/* ── Logo ── */
.vag-logo {
  margin-bottom: 28px;
  line-height: 1;
}

/* AdForest logo tag is an <a> wrapping an <img> */
.vag-logo a {
  display: inline-block;
  line-height: 0;
}

.vag-logo img {
  max-height: 34px;
  max-width: 160px;
  width: auto;
  height: auto;
  /* Invert to white on dark background */
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.vag-site-name {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ── Badge 18+ (signature element) ── */
.vag-badge-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Expanding radar rings */
.vag-badge-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--vag-primary, #ff1700);
  animation: vag-ring-pulse 2.8s ease-out infinite;
  pointer-events: none;
}

.vag-badge-ring--1 {
  opacity: 0.18;
}

.vag-badge-ring--2 {
  opacity: 0.1;
  animation-delay: 1.4s;
}

@keyframes vag-ring-pulse {
  0%   { transform: scale(1);   opacity: inherit; }
  70%  { transform: scale(1.75); }
  100% { transform: scale(2);   opacity: 0; }
}

/* The badge itself */
.vag-badge {
  position: relative;
  z-index: 1;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 2px solid var(--vag-primary, #ff1700);
  background: rgba(255, 23, 0, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  animation: vag-badge-breathe 3.5s ease-in-out infinite;
}

@keyframes vag-badge-breathe {
  0%, 100% { box-shadow: 0 0 0 0   rgba(255, 23, 0, 0.3); }
  50%      { box-shadow: 0 0 16px 4px rgba(255, 23, 0, 0); }
}

.vag-badge-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--vag-primary, #ff1700);
  line-height: 1;
  letter-spacing: -1.5px;
}

.vag-badge-plus {
  font-size: 16px;
  font-weight: 800;
  color: var(--vag-primary, #ff1700);
  align-self: flex-start;
  margin-top: 6px;
  margin-left: 1px;
}

/* ── Title & subtitle ── */
.vag-title {
  font-size: 19px;
  font-weight: 700;
  color: #eef0f4;
  line-height: 1.3;
  letter-spacing: -0.3px;
  margin-bottom: 10px;
}

.vag-subtitle {
  font-size: 13.5px;
  font-weight: 400;
  color: #3e4452;
  line-height: 1.7;
  margin-bottom: 28px;
  padding: 0 6px;
}

/* ── DOB label ── */
.vag-dob-label {
  font-size: 10px;
  font-weight: 700;
  color: #2d3140;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  margin-bottom: 10px;
  text-align: left;
}

/* ── Segmented DOB selector ── */
.vag-selects {
  display: grid;
  grid-template-columns: 68px 1fr 90px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
  margin-bottom: 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.vag-selects:focus-within {
  border-color: rgba(255, 23, 0, 0.35);
  box-shadow: 0 0 0 3px rgba(255, 23, 0, 0.09);
}

.vag-selects.vag-shake {
  animation: vag-shake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes vag-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

.vag-select-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s;
}

.vag-select-col:last-child {
  border-right: none;
}

.vag-select-col:has(select:focus) {
  background: rgba(255, 23, 0, 0.05);
}

.vag-scol-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.18);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 13px 0;
  user-select: none;
  pointer-events: none;
}

.vag-select-wrap {
  position: relative;
  flex: 1;
}

.vag-select-wrap select {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color: #c8cdd8;
  font-family: 'Poppins', 'Quicksand', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 26px 12px 13px;
  cursor: pointer;
}

.vag-select-wrap select option {
  background: #0e1118;
  color: #c8cdd8;
}

/* Custom arrow */
.vag-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 .5 5 5.5 10 .5' fill='none' stroke='%2340464f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}

/* ── Error message ── */
.vag-error {
  min-height: 18px;
  margin-bottom: 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: #ff5555;
  text-align: left;
  line-height: 1.4;
  padding: 0 2px;
}

.vag-error:empty {
  margin-bottom: 4px;
}

/* ── Confirm button ── */
.vag-btn-confirm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  background: var(--vag-primary, #ff1700);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: 'Poppins', 'Quicksand', system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.15px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.22s, transform 0.15s, opacity 0.2s;
  margin-top: 2px;
  /* Prevent FOUC */
  will-change: transform;
}

/* Glossy highlight */
.vag-btn-confirm::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 55%);
  pointer-events: none;
  border-radius: inherit;
}

/* Darken overlay on hover */
.vag-btn-confirm::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  border-radius: inherit;
  transition: background 0.2s;
  pointer-events: none;
}

.vag-btn-confirm:hover:not(:disabled)::after {
  background: rgba(0, 0, 0, 0.12);
}

.vag-btn-confirm:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(220, 20, 0, 0.45);
  transform: translateY(-1px);
}

.vag-btn-confirm:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(220, 20, 0, 0.3);
}

.vag-btn-confirm:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.vag-btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.vag-btn-text {
  position: relative;
  z-index: 1;
  transition: opacity 0.2s;
}

/* ── Loading spinner ── */
.vag-btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: vag-spin 0.65s linear infinite;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.vag-btn-confirm.is-loading .vag-btn-spinner {
  display: block;
}

.vag-btn-confirm.is-loading .vag-btn-text,
.vag-btn-confirm.is-loading .vag-btn-icon {
  opacity: 0.6;
}

@keyframes vag-spin {
  to { transform: rotate(360deg); }
}

/* ── Decline button (simple mode) ── */
.vag-btn-decline {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px 24px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  color: #30353f;
  font-family: 'Poppins', 'Quicksand', system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.vag-btn-decline:hover {
  border-color: rgba(255, 255, 255, 0.14);
  color: #4a5060;
}

/* ── Legal notice ── */
.vag-legal {
  font-size: 11px;
  font-weight: 400;
  color: #20242c;
  line-height: 1.65;
  margin-top: 22px;
  padding: 0 4px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .vag-backdrop,
  .vag-badge-ring,
  .vag-badge,
  .vag-card {
    animation: none !important;
  }

  #vag-overlay.vag-dismissing {
    animation: none !important;
    opacity: 0;
  }
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .vag-card {
    padding: 36px 22px 28px;
    border-radius: 22px;
  }

  .vag-title {
    font-size: 17px;
  }

  .vag-selects {
    grid-template-columns: 58px 1fr 78px;
  }

  .vag-select-wrap select {
    font-size: 13px;
    padding-left: 11px;
  }

  .vag-scol-label {
    padding: 8px 11px 0;
  }
}
