/**
 * V4 Modal Styles — Single source of truth
 *
 * All modal/popup styling for V4 pages lives here.
 * Covers: Bootstrap modals (.modal), .trip-modal, #editTravelInfoModal,
 *         #popup_window, #coverage_limit_modal, #deductible_modal
 */

/* ============================================================
   BACKDROP
   ============================================================ */
.modal-backdrop.show {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-open {
  padding-right: 0px !important;
}
.modal-open .modal {
  padding-right: 0 !important;
}

/* ============================================================
   DIALOG — Vertical centering for ALL modals
   ============================================================ */
.modal .modal-dialog {
  display: flex;
  align-items: center;
  min-height: calc(100% - 1rem);
  margin: 0.5rem auto;
}
@media (min-width: 576px) {
  .modal .modal-dialog {
    min-height: calc(100% - 3.5rem);
    margin: 1.75rem auto;
  }
}

/* ============================================================
   MODAL CONTENT — Base card
   ============================================================ */
.modal .modal-content {
  border-radius: 14px;
  border: 1px solid rgba(11, 43, 70, 0.11);
  box-shadow: 0 12px 40px rgba(28, 40, 64, 0.15);
  overflow: hidden;
  width: 100%;
}

/* ============================================================
   HEADER
   ============================================================ */
.modal .modal-header {
  border-bottom: none;
  padding: 28px 28px 0px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}
.modal .modal-header .modal-title {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0b2b46;
  margin: 0;
}
.modal .modal-header .modal-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #147bd1;
  margin-bottom: 8px;
  display: block;
}
.modal .modal-header .modal-subtitle {
  font-size: 14px;
  line-height: 1.55;
  color: #4d7391;
  margin-top: 6px;
}

/* Close button — pill circle */
.modal .modal-header .close {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(11, 43, 70, 0.11);
  border-radius: 999px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  opacity: 1;
  font-size: 18px;
  font-weight: 400;
  color: #0f476b;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s;
  position: static;
}
.modal .modal-header .close:hover {
  border-color: rgba(11, 43, 70, 0.28);
}
.modal .modal-header .close img {
  width: 14px;
  height: 14px;
}

/* ============================================================
   BODY
   ============================================================ */
.modal .modal-body {
  padding: 10px 28px 32px;
  font-size: 15px;
  line-height: 1.55;
  color: #0f476b;
}
.modal .modal-body p {
  font-size: 15px;
  line-height: 1.55;
  color: #0f476b;
  margin-bottom: 10px;
}
.modal .modal-body h6 {
  font-size: 16px;
  font-weight: 700;
  color: #0b2b46;
  margin-bottom: 12px;
}
.modal .modal-body a {
  color: #147bd1;
}
.modal .modal-body a:hover {
  color: #0f5fa3;
}

/* ============================================================
   FOOTER
   ============================================================ */
.modal .modal-footer {
  border-top: 1px solid rgba(11, 43, 70, 0.08);
  padding: 20px 28px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ============================================================
   FORM ELEMENTS inside modals
   ============================================================ */
.modal label {
  color: #4d7391;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
}
.modal .form-control {
  font-size: 15px;
  font-weight: 700;
  color: #0b2b46;
  line-height: 44px;
  height: 44px;
  border: 1px solid rgba(11, 43, 70, 0.11);
  border-radius: 999px;
  padding: 0 40px 0 18px;
  background: #ffffff;
}
.modal .form-control:focus {
  border-color: #147bd1;
  box-shadow: 0 0 0 3px rgba(20, 123, 209, 0.14);
  outline: none;
}
.modal .form-control::placeholder {
  color: #4d7391;
  font-weight: 400;
}
.modal select.form-control {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath fill='%230f476b' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.modal .help-text {
  font-size: 14px;
  line-height: 1.55;
  color: #4d7391;
  margin-top: 10px;
}

.modal .benefit_details_subtitles {
  margin-bottom: 10px;
}

/* ============================================================
   TINTED FOOTER (edit travel info modal)
   ============================================================ */
.modal .modal-footer-tinted {
  background: #f4f8fc;
  border-radius: 0 0 14px 14px;
}

/* ============================================================
   SIZE VARIANTS
   ============================================================ */
/* Email quote modal — narrow */
.trip-modal .modal-dialog,
.trip-modal.email-modal .modal-dialog {
  max-width: 520px;
}

/* Edit travel info — large */
#editTravelInfoModal .modal-dialog {
  max-width: 860px;
}
#editTravelInfoModal .modal-footer {
  background: #f4f8fc;
  border-radius: 0 0 14px 14px;
}

/* Coverage limits / Plan benefits — wide */
#popup_window {
  z-index: 1072;
}
#popup_window .modal-dialog {
  max-width: 860px;
}
#popup_window .modal-body {
  max-height: 70vh;
  overflow-y: auto;
}
#coverage_limit_modal .modal-dialog,
#deductible_modal .modal-dialog {
  max-width: 620px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 575.9px) {
  .modal .modal-dialog {
    margin: 0.5rem;
  }
  .modal .modal-header {
    padding: 20px 20px 16px;
  }
  .modal .modal-body {
    padding: 20px 20px 24px;
  }
  .modal .modal-footer {
    padding: 16px 20px 20px;
  }
}

/* ============================================================
   IFRAME MODAL FIX
   Inside an iframe, position:fixed modals center in the iframe's
   tall document and end up off-screen (only the backdrop shows).
   JS (common.js) adds .in-iframe on <html> and sets the modal to
   absolute at the current scroll offset; these rules align the
   dialog to the top so it is always visible.
   ============================================================ */
html.in-iframe .modal {
  overflow-y: visible;
  /* Span the full document width, not just the offset parent */
  width: 100%;
  left: 0;
  right: 0;
}
html.in-iframe .modal .modal-dialog {
  align-items: flex-start;
  min-height: auto;
}
html.in-iframe .modal-backdrop {
  position: absolute;
  min-height: 100%;
  width: 100%;
  left: 0;
  right: 0;
}
