/* ==========================================================================
   model.css: popups (all 11 share one style)
   Markup used: #myModalN (overlay), .modal-contentN (panel), .modal-headerN,
   .modal-bodyN, .closeN. Open and close is handled by js/modal.js.
   ========================================================================== */

@keyframes dz-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dz-modal-pop {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 16px)) scale(0.98); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes dz-modal-sheet {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* Dark overlay. Hidden by default, modal.js shows it. */
div[id^="myModal"] {
  display: none;
  position: fixed;
  z-index: 99999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: dz-modal-fade 0.3s ease both;
}

/* Panel */
[id^="myModal"] [class^="modal-content"] {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: min(600px, calc(100% - 2rem));
  max-height: 86vh;
  max-height: min(86dvh, 760px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #FAF8F3;
  border: 1px solid rgba(245, 241, 228, 0.12);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  animation: dz-modal-pop 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Header */
[id^="myModal"] [class^="modal-header"] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  padding: 1rem 1rem 1rem 1.25rem;
  background: #0B4865;
  border-bottom: 3px solid #C9A24B;
  color: #F5F1E4;
}
[id^="myModal"] [class^="modal-header"] h2 {
  margin: 0;
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-weight: 500;
  font-size: clamp(1.125rem, 1rem + 0.7vw, 1.5rem);
  line-height: 1.25;
  color: #F5F1E4 !important;
}

/* Close button */
[id^="myModal"] [class^="close"] {
  float: none;
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(245, 241, 228, 0.14);
  color: #F5F1E4;
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
[id^="myModal"] [class^="close"]:hover {
  background: rgba(245, 241, 228, 0.26);
  color: #F5F1E4;
}
[id^="myModal"] [class^="close"]:focus-visible {
  outline: 2px solid #DAB765;
  outline-offset: 2px;
}

/* Body: scrolls inside the panel while the header stays in place */
[id^="myModal"] [class^="modal-body"] {
  flex: 1 1 auto;
  min-height: 0;
  padding: 1.5rem 1.25rem 1.75rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
[id^="myModal"] [class^="modal-body"] > p {
  margin: 0 0 1rem !important;
  padding: 0 !important;
  font: 400 1rem/1.7 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: rgba(26, 26, 26, 0.85);
}
[id^="myModal"] [class^="modal-body"] > p:last-child { margin-bottom: 0 !important; }

/* Form popups: matching fields and button */
[id^="myModal"] .form-control {
  min-height: 48px;
  padding: 0.75rem 0.9rem;
  font: 400 16px/1.4 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: #1A1A1A;
  background: #fff;
  border: 1px solid rgba(26, 26, 26, 0.18);
  border-radius: 6px;
  box-shadow: none;
}
[id^="myModal"] .form-control::placeholder { color: rgba(26, 26, 26, 0.5); }
[id^="myModal"] .form-control:focus {
  border-color: #0B4865;
  box-shadow: 0 0 0 3px rgba(11, 72, 101, 0.15);
  outline: none;
}
[id^="myModal"] .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto;
  min-height: 48px;
  padding: 0.875rem 1.75rem;
  background: #C9A24B;
  color: #1A1A1A;
  border: 1px solid #C9A24B;
  border-radius: 999px;
  box-shadow: none;
  text-shadow: none;
  font: 600 0.875rem/1 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
[id^="myModal"] .button:hover,
[id^="myModal"] .button:focus-visible {
  background: #DAB765;
  border-color: #DAB765;
  color: #1A1A1A;
}

/* Tablet and desktop */
@media (min-width: 768px) {
  [id^="myModal"] [class^="modal-body"] { padding: 1.75rem 1.75rem 2rem; }
  [id^="myModal"] .button { width: auto; min-width: 220px; }
}

/* Phone: bottom sheet */
@media (max-width: 767.98px) {
  [id^="myModal"] [class^="modal-content"] {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 90vh;
    max-height: 90dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    transform: none;
    animation: dz-modal-sheet 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  [id^="myModal"] [class^="modal-body"] {
    padding-bottom: calc(1.75rem + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  [id^="myModal"],
  [id^="myModal"] [class^="modal-content"] { animation: none; }
}