/* ══════════════════════════════════════════════════════════════════
   Prague Clinics — Weekly Offers & Newsletter Signup Merge Popup CSS
   Scope: Scoped overrides on top of existing newsletter.css
   All customized container classes are prefixed with #pcOffers*
   ══════════════════════════════════════════════════════════════════ */

/* ── Overlay Base Styling ────────────────────────────────────────── */
#pcOffersOverlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 26, 48, 0.85); /* Premium dark transparent overlay */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100001; /* above header (99999) and other widgets */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Active open state */
#pcOffersOverlay.pc-newsletter-active {
  opacity: 1;
  visibility: visible;
}

/* Closing state */
#pcOffersOverlay.pc-offers-closing {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease-in, visibility 0.22s ease-in;
}

/* ── Custom Modal Override ───────────────────────────────────────── */
/* Adjust standard newsletter modal for desktop split-view proportions */
#pcOffersModal {
  background: #122040;
  border: 1px solid rgba(196, 165, 90, 0.3);
  border-radius: 1rem; /* Soft premium border-radius */
  width: 90%;
  max-width: 900px;
  /* Restrict max height strictly to 80% viewport height or 560px for premium proportions */
  height: min(560px, 80vh);
  padding: 0;
  overflow: hidden;
  /* Layered soft shadow design */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 20px 40px -10px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  position: relative;
  
  /* Premium spring ease-out transitions */
  opacity: 0;
  transform: scale(0.96) translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active modal transition */
#pcOffersOverlay.pc-newsletter-active #pcOffersModal {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Closing modal transition */
#pcOffersOverlay.pc-offers-closing #pcOffersModal {
  opacity: 0;
  transform: scale(0.97) translateY(6px);
  transition: opacity 0.22s ease-in, transform 0.22s ease-in;
}

/* ── Merged Grid Container (Desktop & Tablet) ────────────────────── */
.pc-offers-merged-flex {
  display: grid;
  /* Left column takes remaining space; Right column is guaranteed 360px min width to prevent form squishing */
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 1fr);
  width: 100%;
  height: 100%; /* Resolves height relative to parent #pcOffersModal height */
  box-sizing: border-box;
}

/* ── Left Column: Portrait Creative (Hero Column) ────────────────── */
.pc-offers-merged-image-col {
  background: #ffffff; /* White background matching the creative poster */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.pc-offers-merged-image-col picture {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.pc-offers-merged-image-col img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* Never crop, never stretch, preserve ratio */
  object-position: center;
  display: block;
}

/* Fallback placeholder */
.pc-offers-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #f7f9fc;
  color: #c4a55a;
  padding: 3rem;
  box-sizing: border-box;
}

.pc-offers-img-placeholder svg {
  width: 4rem;
  height: 4rem;
  opacity: 0.4;
}

/* ── Right Column: Form Container (Compact & Vertically Balanced) ── */
.pc-offers-merged-form-col {
  padding: 2.25rem; /* Balanced, comfortable padding */
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  background: #122040;
  position: relative;
  overflow-y: auto; /* Internal scrolling fallback for extremely low viewports */
}

/* Adjust title sizes inside the merged layout */
.pc-offers-merged-form-col .pc-newsletter-title {
  font-size: 1.35rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
  text-align: left;
  color: #fff;
  line-height: 1.3;
  padding-right: 2.25rem; /* Safe zone: prevents title text from overlapping close button */
}

.pc-offers-modal[dir="rtl"] .pc-offers-merged-form-col .pc-newsletter-title {
  padding-right: 0;
  padding-left: 2.25rem; /* RTL safe zone */
}

.pc-offers-merged-form-col .pc-newsletter-desc {
  font-size: 0.825rem;
  margin-bottom: 1.25rem;
  text-align: left;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
}

.pc-offers-merged-form-col .pc-newsletter-field {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  width: 100%;
  box-sizing: border-box;
}

.pc-offers-merged-form-col .pc-newsletter-gdpr-wrap {
  margin-bottom: 1.5rem;
}

.pc-offers-merged-form-col .pc-newsletter-submit {
  padding: 0.75rem;
  font-size: 0.875rem;
  width: 100%;
  box-sizing: border-box;
}

.pc-offers-merged-form-col .pc-newsletter-success-icon {
  margin: 0 0 1rem 0;
}

.pc-offers-merged-form-col .pc-newsletter-success-title {
  text-align: left;
  color: #fff;
}

.pc-offers-merged-form-col .pc-newsletter-success-message {
  text-align: left;
  color: rgba(255, 255, 255, 0.7);
}

/* ── Close Button (Anchored precisely to the top-right corner) ───── */
#pcOffersClose {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 32, 64, 0.45); /* Semi-transparent dark overlay bubble */
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

#pcOffersClose:hover {
  background: #c9a84c;
  color: #122040;
  border-color: #c9a84c;
}

/* ── Tablet Overrides: 768px – 1023px ────────────────────────────── */
@media (max-width: 1023px) {
  #pcOffersModal {
    max-width: 480px;
    width: 85%;
    max-height: 85vh;
    height: auto; /* Allow height to flow under mobile column stacking */
  }

  .pc-offers-merged-flex {
    flex-direction: column;
    align-items: stretch;
    display: flex; /* Fallback to flex stacked layout for tablet portrait */
    height: auto;
  }

  .pc-offers-merged-image-col {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    height: 320px;
    max-height: 40vh;
  }

  .pc-offers-merged-form-col {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    padding: 1.75rem 1.5rem;
    overflow-y: visible;
  }
  
  #pcOffersClose {
    top: 1.25rem;
    right: 1.25rem;
  }
}

/* ── Mobile Overrides: ≤767px (Bottom Sheet Layout) ───────────────── */
@media (max-width: 767px) {
  /* Bottom sheet behavior on overlay */
  #pcOffersOverlay {
    align-items: flex-end;
    padding: 0;
  }

  #pcOffersModal {
    max-width: 100%;
    width: 100%;
    border-radius: 1.25rem 1.25rem 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    max-height: 90dvh;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    
    /* Bottom sheet slide-up defaults */
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  #pcOffersOverlay.pc-newsletter-active #pcOffersModal {
    transform: translateY(0);
  }

  #pcOffersOverlay.pc-offers-closing #pcOffersModal {
    transform: translateY(100%);
    transition: transform 0.22s ease-in;
  }

  .pc-offers-merged-flex {
    flex-direction: column;
    align-items: stretch;
    display: flex;
    height: 100%;
    min-height: 0;
    flex-grow: 1;
  }

  .pc-offers-merged-image-col {
    flex-shrink: 0;
    height: clamp(340px, 45dvh, 420px);
    max-height: none;
  }

  .pc-offers-merged-form-col {
    padding: 0.875rem 1.25rem;
    flex-grow: 1;
    flex-shrink: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .pc-offers-merged-form-col .pc-newsletter-title {
    margin-bottom: 0.375rem;
  }

  .pc-offers-merged-form-col .pc-newsletter-desc {
    margin-bottom: 0.75rem;
  }

  .pc-offers-merged-form-col .pc-newsletter-field {
    margin-bottom: 0.75rem;
  }

  .pc-offers-merged-form-col .pc-newsletter-gdpr-wrap {
    margin-bottom: 1rem;
  }

  /* Increase close button target on mobile overlay position */
  #pcOffersClose {
    width: 2.25rem;
    height: 2.25rem;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 1.35rem;
  }
}

/* ── RTL Support for Arabic ──────────────────────────────────────── */
.pc-offers-modal[dir="rtl"] .pc-offers-merged-form-col .pc-newsletter-title,
.pc-offers-modal[dir="rtl"] .pc-offers-merged-form-col .pc-newsletter-desc,
.pc-offers-modal[dir="rtl"] .pc-offers-merged-form-col .pc-newsletter-success-title,
.pc-offers-modal[dir="rtl"] .pc-offers-merged-form-col .pc-newsletter-success-message {
  text-align: right;
}

.pc-offers-modal[dir="rtl"] .pc-offers-merged-form-col .pc-newsletter-gdpr-wrap {
  text-align: right;
}

.pc-offers-modal[dir="rtl"] .pc-offers-merged-form-col .pc-newsletter-field {
  text-align: right;
}

/* ── prefers-reduced-motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #pcOffersOverlay,
  #pcOffersModal {
    transition: none;
    animation: none;
    transform: none;
  }
}
