/* ============================================================================
   Loading cards - from F:\CyprusParadise-NewDesigns\prototypes\loading-screens\
   (assets/ui/wait-card.css + assets/ui/package-line.css), renamed under .cph-wait/.cph-pkg so
   nothing collides with the site's global CSS.

   1. Search wait (_WaitingScreen.cshtml) - holiday/hotel/golf and flight results, transfer and
      car hire searches. Fixed card over a dimmed page; shown/hidden exactly as before (Vue v-if
      on the results pages, `hidden` + waitingScreen.js on the transfer/car hire tabs).
   2. Dates wait (.cph-wait--dates, product page calendar - Calendar.cshtml) - the shorter
      "Searching other dates" card, sitting INSIDE the calendar (.cph-wait--inline), not over
      the page.

   The prototype only animates while a JS ".is-on" class is set; here the card is only in the
   DOM / visible while something is loading, so the animations always run.
   ============================================================================ */

.cph-wait {
  --cph-primary: #02aaa9;
  --cph-primary-dark: #218887;
  --cph-primary-deep: #104443;
  --cph-primary-mist: #def6f5;
  --cph-green-text: #008009;
  --cph-text: #3c4e5a;
  --cph-border: #d8e0e0;
  --cph-font: "Lato", "Segoe UI", sans-serif;

  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(60, 78, 90, 0.32);
  backdrop-filter: blur(10px);
  font-family: var(--cph-font);
  color: var(--cph-text);
}

/* Website Settings > Waiting Background Image(+Mobile), set as --cph-wait-bg on the element. */
.cph-wait[style*="--cph-wait-bg"] {
  background-image: var(--cph-wait-bg);
  background-size: cover;
  background-position: center;
}

.cph-wait[hidden] {
  display: none;
}

.cph-wait *,
.cph-wait *::before,
.cph-wait *::after {
  box-sizing: border-box;
}

.cph-wait__card {
  position: relative;
  width: min(560px, 100%);
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(16, 44, 46, 0.18), inset 0 3px 0 var(--cph-primary);
  animation: cph-wait-in 0.35s ease-out;
}

.cph-wait__body {
  padding: 28px 28px 22px;
  text-align: center;
}

.cph-wait__logo {
  display: block;
  width: min(200px, 62%);
  height: auto;
  margin: 0 auto;
}

/* Optional Website Settings copy (waiting message / subtitle / text) - empty by default. */
.cph-wait__title {
  margin: 12px 0 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--cph-text);
}

.cph-wait__subtitle,
.cph-wait__text {
  margin: 4px 0 0;
  font-size: 13px;
  color: #707070;
}

.cph-wait__text > :first-child { margin-top: 0; }
.cph-wait__text > :last-child { margin-bottom: 0; }

/* ---- Journey strip: dashed line + flying jet over the package line ---- */
.cph-wait__journey {
  position: relative;
  margin: 18px 0 8px;
  padding: 52px 12px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--cph-primary-mist), #fff 72%);
}

.cph-wait__journey::before {
  content: "";
  position: absolute;
  top: 30px;
  left: 18px;
  right: 18px;
  border-top: 1.5px dashed rgba(2, 170, 169, 0.4);
}

.cph-wait__fly {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 50px;
  height: 16px;
  pointer-events: none;
  animation: cph-wait-fly 5.2s cubic-bezier(0.42, 0, 0.2, 1) infinite;
}

.cph-wait__fly img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 0.5px rgba(2, 170, 169, 0.9)) drop-shadow(0 2px 3px rgba(16, 44, 46, 0.22));
}

/* Package line: transfer van + hotel + plane */
.cph-pkg {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px 10px;
  margin: 0;
  color: #141515;
}

.cph-pkg__dots {
  display: flex;
  gap: 6px;
}

.cph-pkg__dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cph-primary);
  animation: cph-wait-dot 1.15s ease-in-out infinite;
}

.cph-pkg__dots i:nth-child(2) { animation-delay: 0.12s; }
.cph-pkg__dots i:nth-child(3) { animation-delay: 0.24s; }
.cph-pkg__dots i:nth-child(4) { animation-delay: 0.36s; }
.cph-pkg__dots i:nth-child(5) { animation-delay: 0.48s; }

.cph-pkg__copy {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
  color: var(--cph-primary);
}

.cph-pkg__plus {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: currentColor;
}

/* Van, hotel and plane all render at 34x28 in the prototype (its per-icon sizes lose to the
   more specific ".wait .pkg img" rule), so that's what's matched here. */
.cph-pkg img {
  display: block;
  flex-shrink: 0;
  width: 34px;
  height: 28px;
  object-fit: contain;
}

.cph-pkg__copy {
  flex-shrink: 0;
}

/* Non-package searches (flights, transfers, car hire): a "Searching ..." line in the strip. */
.cph-wait__finding {
  margin: 8px 0 0;
  color: var(--cph-primary-deep);
  font-size: 15px;
  font-weight: 800;
}

.cph-wait__finding::after {
  content: "";
  display: inline-block;
  width: 1.1em;
  text-align: left;
  animation: cph-wait-ellipsis 1.2s steps(4, end) infinite;
}

.cph-wait__journey .cph-wait__finding {
  margin: 0;
}

/* Hotel / flight / transfer / car hire searches: one icon + copy (_WaitingScreen.cshtml), with
   the "Searching ..." line under it. */
.cph-pkg--single img {
  width: 40px;
  height: 32px;
}

.cph-pkg--single + .cph-wait__finding {
  margin: 8px 0 0;
  font-size: 14px;
}

.cph-wait__protect {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: var(--cph-primary-dark);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cph-wait__protect--plain {
  color: var(--cph-green-text);
  letter-spacing: 0.04em;
}

.cph-wait__badges {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr 0.9fr 1.2fr;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--cph-border);
  list-style: none;
}

/* CMS-supplied badge images can be any count - spread them evenly. */
.cph-wait__badges--cms {
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

.cph-wait__badges img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 58px;
  margin: 0 auto;
  object-fit: contain;
}

/* ---- Dates card (product page calendar) ---- */
.cph-wait__seal {
  display: block;
  width: 96px;
  height: auto;
  margin: 16px auto 4px;
}

.cph-wait__scan {
  position: relative;
  height: 44px;
  margin: 14px 4px 2px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--cph-primary-mist), #fff 78%);
}

.cph-wait__scan::before {
  content: "";
  position: absolute;
  top: 22px;
  left: 16px;
  right: 16px;
  border-top: 1.5px dashed rgba(2, 170, 169, 0.45);
}

.cph-wait__scan .cph-wait__fly {
  top: 10px;
}

/* Inline (inside the calendar instead of over the page): fills its positioned parent. */
.cph-wait--inline {
  position: absolute;
  z-index: 5;
  padding: 16px;
  border-radius: 14px;
  background: rgba(244, 248, 248, 0.86);
  backdrop-filter: blur(4px);
}

.cph-wait--inline .cph-wait__card {
  width: min(380px, 100%);
}

.cph-wait--inline .cph-wait__body {
  padding: 22px 20px 18px;
}

/* ---- Animations ---- */
@keyframes cph-wait-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes cph-wait-fly {
  0% { left: 6px; opacity: 0; }
  14% { opacity: 1; }
  86% { opacity: 1; }
  100% { left: calc(100% - 60px); opacity: 0; }
}

@keyframes cph-wait-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.55); opacity: 0.4; }
}

@keyframes cph-wait-ellipsis {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

/* ---- Mobile ---- */
@media (max-width: 520px) {
  .cph-wait {
    padding: 12px;
    /* Centred on screen like desktop (was align-items:end - a bottom sheet). */
    align-items: center;
  }

  .cph-wait[style*="--cph-wait-bg-mobile"] {
    background-image: var(--cph-wait-bg-mobile);
  }

  .cph-wait--inline {
    align-items: center;
  }

  .cph-wait__card {
    width: 100%;
  }

  .cph-wait__body {
    padding: 24px 16px 18px;
  }

  /* Trust badges stay on one line on phones (was a 2x2 grid), just smaller. */
  .cph-wait__badges,
  .cph-wait__badges--cms {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .cph-wait__badges img {
    height: 34px;
  }

  .cph-wait__journey {
    padding-top: 44px;
  }

  .cph-wait__journey::before {
    top: 24px;
  }

  .cph-wait__fly {
    top: 6px;
  }

  .cph-pkg {
    gap: 6px 8px;
  }

  .cph-pkg__copy {
    font-size: 9px;
  }

  .cph-pkg__plus {
    font-size: 16px;
  }

  .cph-pkg__dots:last-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cph-wait__card,
  .cph-wait__fly,
  .cph-pkg__dots i,
  .cph-wait__finding::after {
    animation: none;
  }

  .cph-wait__fly {
    left: calc(50% - 25px);
    opacity: 1;
  }
}

/* Inside the alternative flights popup (AlternateFlightsModal.cshtml): covers the popup's content
   (which has a fixed height, JourneyPages.css #alternativeFlightModal .modal-content) while
   altFlightsLoading, at the full search-card width. */
.cph-wait--modal {
  z-index: 20;
  border-radius: inherit;
}

.cph-wait--modal .cph-wait__card {
  width: min(560px, 100%);
}

/* Narrow cards (phones, and the card inside the alternative flights popup): drop the dot rows and
   let the transfer copy wrap, so the van + hotel + plane line always fits inside the card. */
@media (max-width: 520px) {
  .cph-pkg__dots {
    display: none;
  }

  .cph-pkg__copy {
    flex-shrink: 1;
    min-width: 0;
  }

  .cph-wait--modal {
    padding: 10px;
  }

  .cph-wait--modal .cph-wait__body {
    padding: 20px 14px 16px;
  }
}
