/**
 * POPUP SYSTEM — danielwozniak.eu
 * Reusable modal popups for lead capture
 * Fire Crew inspired, DW brand
 * Created: 2026-03-19 by BENJI
 */

/* ═══ OVERLAY ═══ */
.dw-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: dwPopupFadeIn 0.3s ease;
}
.dw-popup-overlay.active { display: flex; }

@keyframes dwPopupFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dw-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 13, 26, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ═══ MODAL CARD ═══ */
.dw-popup-card {
  position: relative;
  background: linear-gradient(165deg, rgba(17, 34, 64, 0.98) 0%, rgba(10, 25, 47, 0.99) 50%, rgba(5, 13, 26, 1) 100%);
  border: 1px solid rgba(247, 147, 30, 0.2);
  border-radius: 24px;
  max-width: 520px;
  width: 100%;
  z-index: 1;
  overflow: hidden;
  animation: dwPopupCardEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(247, 147, 30, 0.06);
}

@keyframes dwPopupCardEnter {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Orange top accent line */
.dw-popup-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-orange, #f7931e), var(--accent-blue, #007acc));
  border-radius: 24px 24px 0 0;
}

/* ═══ CLOSE BUTTON ═══ */
.dw-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  line-height: 1;
  z-index: 10;
}
.dw-popup-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: rotate(90deg);
}

/* ═══ HEADER ═══ */
.dw-popup-header {
  padding: 2rem 2.5rem 1.25rem;
  text-align: center;
}

.dw-popup-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-orange, #f7931e);
  background: rgba(247, 147, 30, 0.1);
  border: 1px solid rgba(247, 147, 30, 0.2);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.dw-popup-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}
.dw-popup-title span {
  background: linear-gradient(135deg, var(--accent-orange, #f7931e), var(--accent-blue, #007acc));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dw-popup-subtitle {
  font-size: 0.88rem;
  color: #8892b0;
  line-height: 1.5;
  margin: 0;
}

/* ═══ VALUE SECTION (checklist) ═══ */
.dw-popup-value {
  padding: 0 2.5rem 1.25rem;
}

.dw-popup-value-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  color: #cbd5e1;
}
.dw-popup-value-item:last-child { border-bottom: none; }

.dw-popup-value-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dw-popup-value-check svg {
  width: 12px;
  height: 12px;
  stroke: #10b981;
  stroke-width: 2.5;
  fill: none;
}

/* ═══ FORM ═══ */
.dw-popup-form {
  padding: 0 2.5rem 2rem;
}

.dw-popup-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: all 0.3s;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}
.dw-popup-input::placeholder { color: #495670; }
.dw-popup-input:focus {
  border-color: rgba(247, 147, 30, 0.3);
  box-shadow: 0 0 0 3px rgba(247, 147, 30, 0.08);
  background: rgba(255, 255, 255, 0.07);
}

.dw-popup-consent {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  cursor: pointer;
}
.dw-popup-consent input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--accent-orange, #f7931e);
}
.dw-popup-consent span {
  font-size: 0.72rem;
  color: #495670;
  line-height: 1.5;
}
.dw-popup-consent a {
  color: #4f96d8;
  text-decoration: none;
}
.dw-popup-consent a:hover { text-decoration: underline; }

.dw-popup-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-orange, #f7931e) 0%, #ff8c00 100%);
  border: none;
  color: #fff;
  padding: 1rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(247, 147, 30, 0.3);
  position: relative;
  overflow: hidden;
}
.dw-popup-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(247, 147, 30, 0.4);
}
.dw-popup-submit:active { transform: translateY(0); }
.dw-popup-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Shimmer effect on hover */
.dw-popup-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}
.dw-popup-submit:hover::before { left: 100%; }

/* ═══ TRUST FOOTER ═══ */
.dw-popup-trust {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.dw-popup-trust-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: #10b981;
  font-weight: 500;
}
.dw-popup-trust-item svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ═══ SUCCESS STATE ═══ */
.dw-popup-success {
  display: none;
  text-align: center;
  padding: 3rem 2.5rem;
}
.dw-popup-success.active { display: block; }
.dw-popup-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.dw-popup-success-icon svg {
  width: 32px;
  height: 32px;
  stroke: #10b981;
  stroke-width: 2;
  fill: none;
}
.dw-popup-success h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.5rem;
}
.dw-popup-success p {
  font-size: 0.88rem;
  color: #8892b0;
  margin: 0;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .dw-popup-overlay { padding: 16px; align-items: flex-end; }
  .dw-popup-card {
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 24px 24px 0 0;
    animation: dwPopupCardEnterMobile 0.35s ease;
  }
  @keyframes dwPopupCardEnterMobile {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  .dw-popup-header { padding: 1.5rem 1.5rem 1rem; }
  .dw-popup-title { font-size: 1.35rem; }
  .dw-popup-value { padding: 0 1.5rem 1rem; }
  .dw-popup-form { padding: 0 1.5rem 1.5rem; }
  .dw-popup-trust { gap: 1rem; padding: 0.75rem 1.25rem; flex-wrap: wrap; justify-content: center; }
  .dw-popup-submit { min-height: 52px; }
  .dw-popup-input { min-height: 48px; font-size: 16px; /* prevents iOS zoom */ }
}

@media (max-width: 480px) {
  .dw-popup-header { padding: 1.25rem 1.25rem 0.75rem; }
  .dw-popup-value { padding: 0 1.25rem 0.75rem; }
  .dw-popup-form { padding: 0 1.25rem 1.25rem; }
  .dw-popup-title { font-size: 1.2rem; }
}

/* Prevent body scroll when popup open */
body.dw-popup-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .dw-popup-card { animation: none !important; }
  .dw-popup-overlay { animation: none !important; }
}
