/* FoodXPopup CSS */

/* Popup Overlay */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  user-select: none; /* Metin seçimini engelle */
  -webkit-user-select: none; /* Safari için */
  -moz-user-select: none; /* Firefox için */
  -ms-user-select: none; /* IE için */
}

/* Fullscreen overlay: JS ekler, padding'i sıfırla */
.popup-overlay.fx-fullscreen { padding: 0; align-items: stretch; justify-content: stretch; }

/* Global spinner mounted directly under overlay during preload */
.popup-global-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000; /* above container while hidden */
}
.popup-global-loading::after {
  content: "";
  width: 32px;
  height: 32px;
  border: 3px solid #ddd;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: foodx-spin 0.9s linear infinite;
}

/* Loading overlay shown while iframe is loading */
.popup-loading {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  /* top dynamic: set via JS to header height */
  background: rgba(255,255,255,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3;
}
.popup-loading::after {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid #ddd;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: foodx-spin 0.9s linear infinite;
}

@keyframes foodx-spin {
  to { transform: rotate(360deg); }
}

/* Popup Container */
.popup-container {
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  max-width: 100%;
  max-height: 100%;
  transform: translateY(100vh);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), width 0.3s ease, height 0.3s ease;
  user-select: none; /* Container içindeki elementlerin seçimini engelle */
  -webkit-user-select: none; /* Safari için */
  -moz-user-select: none; /* Firefox için */
  -ms-user-select: none; /* IE için */
  display: flex;               /* header + iframe dikey yerleşim */
  flex-direction: column;
  box-sizing: border-box;      /* taşmaları önle */
}

.popup-container.show {
  transform: translateY(0);
}

/* Popup Header */
.popup-header {
  position: relative;
  background: var(--primary-color);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2; /* iframe üstünde kal */
}

/* Güvenli alan desteği - mobil tam ekran (çentik) */
.popup-container.mobile .popup-header { padding-top: calc(16px + env(safe-area-inset-top, 0)); }
.popup-container.mobile .popup-close-btn { top: calc(12px + env(safe-area-inset-top, 0)); }

.popup-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin: 0;
  font-family: var(--primary-font, 'Oswald', Arial, sans-serif);
}

.popup-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.5);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.popup-close-btn:hover { background: rgba(255,255,255,0.12); transform: scale(1.05); }

.popup-close-btn svg {
  width: 18px;
  height: 18px;
  stroke: #ffffff;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Popup Content (iframe) */
.popup-content {
  width: 100%;
  height: auto;           /* 100% yerine auto */
  border: none;
  display: block;
  pointer-events: auto;   /* Iframe içindeki etkileşimleri aktif tut */
  flex: 1 1 auto;         /* Kalan yüksekliği kullan */
  min-height: 0;          /* NEW: flex column shrink fix for mobile */
}

/* Desktop specific styles */
@media (min-width: 768px) {
  .popup-container.desktop {
    /* Desktop boyutları parametre ile gelecek */
  }
}

/* Mobile specific styles */
@media (max-width: 767px) {
  .popup-overlay {
    padding: 0;
    padding-top: env(safe-area-inset-top, 0);      /* üst güvenli alan */
    padding-bottom: env(safe-area-inset-bottom, 0);/* alt güvenli alan */
  }
  
  .popup-container.mobile {
    position: fixed;             /* TAM ekran sabitle */
    top: 0; left: 0; right: 0; bottom: 0; /* kenarlara yapıştır */
    width: 100vw;                /* JS yükseklik ayarlayacak (visualViewport) */
    height: 100svh;              /* fallback: dinamik vh */
    border-radius: 0;
    max-width: 100vw;
    max-height: 100svh;
  }
}

/* Tam ekran modu için animasyon düzeltmesi */
/* Tam ekran modu için: JS kontrolü öncelikli.
   Desktop daraldığında yüzde bazlı ölçüler boşluk bırakmaz; 
   mobilde JS yükseklik verir, yoksa media query'deki svh devreye girer. */
.popup-container.mobile {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  max-width: 100%;
  max-height: 100%;
}
