/**
 * ============================================
 * Popups System - CSS
 * ============================================
 * מערכת Popups חכמה: Exit Intent + Entry Popup
 */

/* ============================================
   Popup Overlay
   ============================================ */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal, 1300);

  /* Backdrop */
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  /* Transition */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Center content */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Active state */
.popup-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* ============================================
   Popup Container
   ============================================ */
.popup {
  position: relative;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;

  /* Background */
  background: var(--color-bg-dark, #0D1117);

  /* Border */
  border: 1px solid rgba(192, 192, 192, 0.2);
  border-radius: 16px;

  /* Shadow */
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);

  /* Transform */
  transform: scale(0.9) translateY(-20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Active state */
.popup-overlay.active .popup {
  transform: scale(1) translateY(0);
}

/* ============================================
   Popup Header
   ============================================ */
.popup-header {
  position: relative;
  padding: 2rem;
  text-align: center;

  /* Gradient border bottom */
  border-bottom: 1px solid rgba(192, 192, 192, 0.1);
}

.popup-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  animation: popupIconBounce 1s ease infinite;
}

.popup-title {
  font-family: var(--font-family-heading, 'Heebo', sans-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text-primary, #FAFAF9);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.popup-subtitle {
  font-family: var(--font-family-body, 'Assistant', sans-serif);
  font-size: 1rem;
  color: var(--color-text-secondary, #94A3B8);
  margin: 0;
  line-height: 1.5;
}

/* Close button */
.popup-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;

  background: rgba(192, 192, 192, 0.1);
  border: 1px solid rgba(192, 192, 192, 0.2);
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--color-text-secondary, #94A3B8);
  font-size: 1.5rem;
  cursor: pointer;

  transition: all 0.3s ease;
}

.popup-close:hover {
  background: rgba(192, 192, 192, 0.2);
  color: var(--color-text-primary, #FAFAF9);
  transform: rotate(90deg);
}

.popup-close:focus {
  outline: 3px solid var(--focus-outline-color, #38BDF8);
  outline-offset: 2px;
}

/* ============================================
   Popup Body
   ============================================ */
.popup-body {
  padding: 2rem;
}

.popup-text {
  font-family: var(--font-family-body, 'Assistant', sans-serif);
  font-size: 1.125rem;
  color: var(--color-text-primary, #FAFAF9);
  line-height: 1.7;
  margin: 0 0 1.5rem 0;
  text-align: center;
}

/* Features list */
.popup-features {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem 0;
}

.popup-feature {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  margin-bottom: 0.5rem;

  background: rgba(192, 192, 192, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(192, 192, 192, 0.1);

  font-family: var(--font-family-body, 'Assistant', sans-serif);
  font-size: 1rem;
  color: var(--color-text-primary, #FAFAF9);

  transition: all 0.3s ease;
}

.popup-feature:hover {
  background: rgba(192, 192, 192, 0.1);
  border-color: rgba(192, 192, 192, 0.2);
  transform: translateX(-4px);
}

.popup-feature-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* ============================================
   Popup Footer
   ============================================ */
.popup-footer {
  padding: 0 2rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.popup-cta {
  width: 100%;
  padding: 1rem 2rem;
  min-height: 56px;

  background: linear-gradient(
    135deg,
    var(--color-primary-silver, #C0C0C0),
    var(--color-gold-champagne, #C9A961)
  );

  color: var(--color-navy-deep, #0A2540);
  font-family: var(--font-family-heading, 'Heebo', sans-serif);
  font-size: 1.125rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;

  border: none;
  border-radius: 8px;
  cursor: pointer;

  box-shadow: 0 4px 12px rgba(192, 192, 192, 0.3);
  transition: all 0.3s ease;
}

.popup-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(192, 192, 192, 0.4);
}

.popup-cta:active {
  transform: translateY(0);
}

.popup-cta:focus {
  outline: 3px solid var(--focus-outline-color, #38BDF8);
  outline-offset: 2px;
}

.popup-dismiss {
  padding: 0.75rem;
  background: none;
  border: none;
  color: var(--color-text-secondary, #94A3B8);
  font-family: var(--font-family-body, 'Assistant', sans-serif);
  font-size: 0.875rem;
  text-align: center;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.3s ease;
}

.popup-dismiss:hover {
  color: var(--color-text-primary, #FAFAF9);
}

/* ============================================
   Exit Intent Specific Styles
   ============================================ */
.popup.exit-intent .popup-icon {
  animation: exitWave 1s ease-in-out infinite;
}

@keyframes exitWave {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(15deg);
  }
  75% {
    transform: rotate(-15deg);
  }
}

/* ============================================
   Entry Popup Specific Styles
   ============================================ */
.popup.entry-popup .popup-icon {
  animation: entrySparkle 2s ease-in-out infinite;
}

@keyframes entrySparkle {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* ============================================
   Responsive - Mobile
   ============================================ */
@media (max-width: 768px) {
  .popup {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .popup-header,
  .popup-body,
  .popup-footer {
    padding: 1.5rem;
  }

  .popup-title {
    font-size: 1.5rem;
  }

  .popup-subtitle {
    font-size: 0.875rem;
  }

  .popup-text {
    font-size: 1rem;
  }

  .popup-feature {
    font-size: 0.875rem;
  }
}

/* ============================================
   Dark/Light mode compatibility
   ============================================ */
body.light-mode .popup {
  background: var(--color-bg-light, #FFFFFF);
  border-color: rgba(15, 23, 42, 0.2);
}

body.light-mode .popup-title {
  color: var(--color-navy-deep, #0A2540);
}

body.light-mode .popup-subtitle,
body.light-mode .popup-text {
  color: var(--color-text-secondary, #475569);
}

body.light-mode .popup-feature {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.1);
  color: var(--color-navy-deep, #0A2540);
}

body.light-mode .popup-overlay {
  background: rgba(255, 255, 255, 0.8);
}

/* ============================================
   High contrast mode
   ============================================ */
body.high-contrast .popup {
  background: #000000;
  border: 3px solid #FFFFFF;
}

body.high-contrast .popup-title,
body.high-contrast .popup-text,
body.high-contrast .popup-feature {
  color: #FFFFFF;
}

/* ============================================
   No animations mode
   ============================================ */
body.no-animations .popup-overlay,
body.no-animations .popup,
body.no-animations .popup-icon,
body.no-animations .popup-close,
body.no-animations .popup-feature,
body.no-animations .popup-cta {
  animation: none !important;
  transition: none !important;
}

/* ============================================
   Print styles
   ============================================ */
@media print {
  .popup-overlay {
    display: none;
  }
}

/* ============================================
   Icon bounce animation
   ============================================ */
@keyframes popupIconBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}
