/* ==========================================================================
   Enquiry Popup — Gopinath Nambiar & Associates
   Markup: include/enquiry-popup.php · Logic: js/enquiry-popup.js
   All selectors are prefixed with .gn-popup so nothing clashes with the theme.
   ========================================================================== */

.gn-popup {
  --gnp-gold: #a98643;
  --gnp-gold-dark: #8f6f32;
  --gnp-navy: #002455;
  --gnp-navy-2: #17305e;
  --gnp-text: #1f2633;
  --gnp-muted: #5f6b7a;
  --gnp-border: #d7dce3;
  --gnp-error: #c20f18;
  --gnp-success: #1e7e45;

  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: "Poppins", sans-serif;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.gn-popup[hidden] { display: none; }

.gn-popup.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.gn-popup__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 20, 48, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.gn-popup__dialog {
  position: relative;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  width: 100%;
  max-width: 860px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 20, 48, 0.35);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  outline: none;
}

.gn-popup.is-open .gn-popup__dialog { transform: none; }

/* Close button */
.gn-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f1f3f6;
  color: var(--gnp-navy);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.gn-popup__close:hover { background: var(--gnp-navy); color: #fff; transform: rotate(90deg); }
.gn-popup__close:focus-visible { outline: 2px solid var(--gnp-gold); outline-offset: 2px; }

/* Left intro panel */
.gn-popup__intro {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 40px 32px;
  color: #fff;
  background: linear-gradient(150deg, var(--gnp-navy) 0%, var(--gnp-navy-2) 55%, var(--gnp-gold-dark) 140%);
  overflow-y: auto;
}

.gn-popup__eyebrow {
  align-self: flex-start;
  margin-bottom: 14px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.6;
  text-transform: uppercase;
  color: var(--gnp-navy);
  background: var(--gnp-gold);
  border-radius: 30px;
}

.gn-popup .gn-popup__title {
  margin: 0 0 12px;
  font-size: 28px !important; /* theme forces h2 sizes with !important */
  font-weight: 700;
  line-height: 1.25 !important;
  color: #fff;
}

.gn-popup__desc {
  margin: 0 0 22px;
  font-size: 14.5px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.85);
}

.gn-popup__points {
  margin: 0 0 26px;
  padding: 0;
  list-style: none;
}
.gn-popup .gn-popup__points li {
  display: block;
  float: none;
  position: relative;
  margin-bottom: 10px;
  padding-left: 28px;
  font-size: 14px;
  line-height: 1.5;
  color: #fff;
}
.gn-popup__points li::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gnp-gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%23002455' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.gn-popup__call {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.4;
  color: #fff !important;
  text-decoration: none !important;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  transition: background 0.2s ease;
}
.gn-popup__call:hover { background: rgba(255, 255, 255, 0.18); }
.gn-popup__call svg { flex-shrink: 0; color: var(--gnp-gold); }
.gn-popup__call strong { color: #fff; font-weight: 600; white-space: nowrap; }

/* Right form panel */
.gn-popup__body {
  padding: 40px 32px 28px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.gn-popup__form { margin: 0; }

.gn-popup__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.gn-popup__field { margin-bottom: 14px; min-width: 0; }

.gn-popup__field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--gnp-text);
}
.gn-popup__field label span { color: var(--gnp-error); }

.gn-popup__field input,
.gn-popup__field select,
.gn-popup__field textarea {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 11px 13px;
  font-family: inherit;
  font-size: 15px; /* >= 15px keeps iOS from zooming in on focus */
  line-height: 1.4;
  color: var(--gnp-text);
  background: #fff;
  border: 1px solid var(--gnp-border);
  border-radius: 8px;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.gn-popup__field select {
  padding-right: 38px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23002455' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center / 16px no-repeat;
  cursor: pointer;
}
.gn-popup__field textarea { min-height: 84px; resize: vertical; }

.gn-popup__field input::placeholder,
.gn-popup__field textarea::placeholder { color: #9aa4b1; opacity: 1; }

.gn-popup__field input:focus,
.gn-popup__field select:focus,
.gn-popup__field textarea:focus {
  outline: none;
  border-color: var(--gnp-navy);
  box-shadow: 0 0 0 3px rgba(0, 36, 85, 0.12);
}

.gn-popup__field.has-error input,
.gn-popup__field.has-error select,
.gn-popup__field.has-error textarea {
  border-color: var(--gnp-error);
  box-shadow: 0 0 0 3px rgba(194, 15, 24, 0.1);
}

.gn-popup__error {
  display: block;
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--gnp-error);
}

/* Honeypot — hidden from people, visible to bots */
.gn-popup__hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.gn-popup__status {
  min-height: 0;
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--gnp-error);
}
.gn-popup__status:empty { display: none; }

.gn-popup__submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(45deg, var(--gnp-gold), var(--gnp-navy));
  background-size: 160% 100%;
  background-position: 0 0;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background-position 0.35s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.gn-popup__submit:hover { background-position: 100% 0; box-shadow: 0 8px 20px rgba(0, 36, 85, 0.22); }
.gn-popup__submit:focus-visible { outline: 2px solid var(--gnp-gold); outline-offset: 3px; }
.gn-popup__submit[disabled] { cursor: wait; opacity: 0.8; }

.gn-popup__submit--ghost {
  width: auto;
  min-width: 140px;
  color: var(--gnp-navy);
  background: #fff;
  border: 1.5px solid var(--gnp-navy);
}
.gn-popup__submit--ghost:hover { color: #fff; background: var(--gnp-navy); }

.gn-popup__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gn-popup-spin 0.7s linear infinite;
}
.gn-popup__form.is-loading .gn-popup__spinner { display: inline-block; }

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

.gn-popup__note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--gnp-muted);
}

/* Success state */
.gn-popup__success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 20px 0;
  text-align: center;
}
.gn-popup__success[hidden] { display: none; }
.gn-popup__success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  color: #fff;
  background: var(--gnp-success);
  border-radius: 50%;
}
.gn-popup .gn-popup__success h3 { margin: 0 0 8px; font-size: 24px !important; font-weight: 700; line-height: 1.3 !important; color: var(--gnp-navy); }
.gn-popup__success p { max-width: 320px; margin: 0 0 22px; font-size: 14.5px; line-height: 1.6; color: var(--gnp-muted); }

/* Lock page scroll while open (class added to <html> and <body>) */
.gn-popup-open,
.gn-popup-open body { overflow: hidden !important; }

/* ----- Responsive ----- */
@media (max-width: 767.98px) {
  .gn-popup { align-items: flex-end; padding: 0; }

  .gn-popup__dialog {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .gn-popup__intro { padding: 22px 56px 18px 20px; overflow: visible; }
  .gn-popup__eyebrow { margin-bottom: 8px; font-size: 11px; }
  .gn-popup .gn-popup__title { margin-bottom: 6px; font-size: 21px !important; line-height: 1.3 !important; }
  .gn-popup__desc { margin: 0; font-size: 13.5px; line-height: 1.55; }
  .gn-popup__points,
  .gn-popup__call { display: none; }

  .gn-popup__close {
    top: 14px;
    right: 14px;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
  }
  .gn-popup__close:hover { color: var(--gnp-navy); background: #fff; }

  .gn-popup__body { padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 480px) {
  .gn-popup__row { grid-template-columns: 1fr; }
}

/* Very short screens (landscape phones) */
@media (max-height: 520px) and (max-width: 991.98px) {
  .gn-popup__desc { display: none; }
  .gn-popup__field textarea { min-height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .gn-popup,
  .gn-popup__dialog,
  .gn-popup__close,
  .gn-popup__submit { transition: none !important; }
  .gn-popup__spinner { animation-duration: 1.5s; }
}
