/*
 * FlexxiStay — styles for the Full Day & Night stay chooser.
 *
 * Colours are taken from the existing booking popup (#7c3aed violet with a
 * #f59e0b amber accent) so the chooser reads as part of the same flow rather
 * than a bolted-on dialog.
 */

.fxstay-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.18s ease;
  overflow-y: auto;
}

.fxstay-overlay.is-open {
  opacity: 1;
}

body.fxstay-locked {
  overflow: hidden;
}

.fxstay-sheet {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  padding: 1.15rem 1.15rem 1rem;
  transform: translateY(10px) scale(0.985);
  transition: transform 0.2s ease;
}

.fxstay-overlay.is-open .fxstay-sheet {
  transform: translateY(0) scale(1);
}

/*
 * The calendar is tall, so on short screens the price summary would scroll
 * under the sticky action bar. Ordering the sheet children puts the summary
 * and availability line directly under the mode options instead, keeping the
 * nights and total visible whatever the viewport height.
 */
.fxstay-sheet > * {
  flex: 0 0 auto;
}

.fxstay-head {
  order: 1;
}

.fxstay-options {
  order: 2;
}

.fxstay-summary {
  order: 3;
}

.fxstay-status {
  order: 4;
}

.fxstay-calendar {
  order: 5;
}

.fxstay-actions {
  order: 6;
  margin-top: auto;
}

.fxstay-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #475569;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.fxstay-close:hover,
.fxstay-close:focus-visible {
  background: #e2e8f0;
  color: #0f172a;
  outline: none;
}

.fxstay-head {
  padding-right: 2rem;
  margin-bottom: 0.85rem;
}

.fxstay-kicker {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.09);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  margin-bottom: 0.45rem;
}

.fxstay-title {
  margin: 0 0 0.2rem;
  font-size: 1.08rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.fxstay-hotel {
  margin: 0;
  font-size: 0.82rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Mode options ---------- */

.fxstay-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.fxstay-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  text-align: left;
  padding: 0.7rem 0.65rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.fxstay-option:hover {
  border-color: #c4b5fd;
  background: #faf9ff;
}

.fxstay-option:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 1px;
}

.fxstay-option.is-active {
  border-color: #7c3aed;
  background: rgba(124, 58, 237, 0.06);
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.12);
}

.fxstay-option-icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.1);
  color: #7c3aed;
}

.fxstay-option-icon svg {
  width: 16px;
  height: 16px;
}

.fxstay-option-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.fxstay-option-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.fxstay-option-note {
  font-size: 0.68rem;
  color: #64748b;
  line-height: 1.3;
}

.fxstay-option-check {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
}

.fxstay-option.is-active .fxstay-option-check {
  border-color: #7c3aed;
  background: #7c3aed;
  box-shadow: inset 0 0 0 3px #ffffff;
}

/* ---------- Calendar ---------- */

.fxstay-calendar {
  border: 1px solid #eef2f7;
  border-radius: 14px;
  background: #fcfcfe;
  padding: 0.6rem 0.55rem 0.5rem;
  margin-bottom: 0.8rem;
}

.fxstay-calendar[hidden] {
  display: none;
}

.fxstay-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.fxstay-cal-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

.fxstay-cal-nav {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.fxstay-cal-nav svg {
  width: 15px;
  height: 15px;
}

.fxstay-cal-nav:hover:not(:disabled) {
  background: #f1f5f9;
  color: #0f172a;
}

.fxstay-cal-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.fxstay-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 2px;
}

.fxstay-cal-weekdays span {
  text-align: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 0.15rem 0;
}

.fxstay-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.fxstay-cal-blank {
  display: block;
  height: 32px;
}

.fxstay-cal-day {
  position: relative;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #1e293b;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.fxstay-cal-day:hover:not(:disabled) {
  background: rgba(124, 58, 237, 0.12);
  color: #5b21b6;
}

.fxstay-cal-day:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: -1px;
}

.fxstay-cal-day.is-disabled,
.fxstay-cal-day:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
  background: transparent;
}

.fxstay-cal-day.is-in-range {
  background: rgba(124, 58, 237, 0.1);
  border-radius: 0;
  color: #4c1d95;
}

.fxstay-cal-day.is-checkin {
  background: rgba(245, 158, 11, 0.16);
  color: #92400e;
  font-weight: 700;
  box-shadow: inset 0 0 0 1.5px rgba(245, 158, 11, 0.55);
}

.fxstay-cal-day.is-checkout {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(109, 40, 217, 0.35);
}

.fxstay-cal-day.is-checkout:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
  color: #ffffff;
}

.fxstay-cal-hint {
  margin: 0.4rem 0 0;
  font-size: 0.66rem;
  color: #94a3b8;
  text-align: center;
}

/* ---------- Summary + status ---------- */

.fxstay-summary {
  border: 1px solid #eef2f7;
  border-radius: 12px;
  background: #f8fafc;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.5rem;
}

.fxstay-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.16rem 0;
  font-size: 0.78rem;
}

.fxstay-summary-key {
  color: #64748b;
}

.fxstay-summary-value {
  color: #0f172a;
  font-weight: 700;
  text-align: right;
}

.fxstay-status {
  min-height: 1.05rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.55rem;
  color: #64748b;
}

.fxstay-status.is-ok {
  color: #047857;
}

.fxstay-status.is-error {
  color: #b91c1c;
}

.fxstay-status.is-checking {
  color: #7c3aed;
}

/* ---------- Actions ---------- */

.fxstay-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.fxstay-btn {
  flex: 1 1 auto;
  height: 42px;
  border-radius: 11px;
  border: 1.5px solid transparent;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.fxstay-btn:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

.fxstay-btn-ghost {
  flex: 0 0 96px;
  background: #ffffff;
  border-color: #e2e8f0;
  color: #475569;
}

.fxstay-btn-ghost:hover {
  background: #f8fafc;
  color: #0f172a;
}

.fxstay-btn-primary {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(109, 40, 217, 0.28);
}

.fxstay-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(109, 40, 217, 0.34);
}

.fxstay-btn-primary:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Mobile: bottom sheet ---------- */

@media (max-width: 640px) {
  .fxstay-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .fxstay-sheet {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding: 1rem 0.9rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
    transform: translateY(24px);
  }

  .fxstay-overlay.is-open .fxstay-sheet {
    transform: translateY(0);
  }

  .fxstay-options {
    grid-template-columns: 1fr;
  }

  .fxstay-cal-day,
  .fxstay-cal-blank {
    height: 38px;
  }

  .fxstay-cal-day {
    font-size: 0.82rem;
  }

  .fxstay-btn {
    height: 46px;
    font-size: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fxstay-overlay,
  .fxstay-sheet,
  .fxstay-btn,
  .fxstay-cal-day {
    transition: none;
  }
}
