/* ═══════════════════════════════════════════════════════════
   FLIGHT DATE PICKER — Compact Premium Calendar UI
   ═══════════════════════════════════════════════════════════ */

@keyframes fdp-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

@keyframes fdp-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ── Field trigger wrapper ── */
.fdp-field-wrap { position: relative; }

.fdp-trigger {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
  gap: 2px;
  outline: none;
}

.fdp-trigger:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.35);
  outline-offset: 2px;
  border-radius: 4px;
}

.fdp-lbl { cursor: pointer; }

/* ── Floating Panel — portaled into body, absolute-positioned ── */
.fdp-panel {
  position: absolute;
  width: 560px;
  z-index: 99999;
  background: #ffffff;
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 2px 8px rgba(0, 0, 0, 0.04),
    0 10px 28px rgba(0, 0, 0, 0.09),
    0 24px 56px rgba(0, 0, 0, 0.07);
  padding: 0;
  overflow: hidden;
  animation: fdp-in 0.18s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

/* ── Calendars ── */
.fdp-calendars {
  display: flex;
  align-items: flex-start;
  padding: 16px 16px 0;
  gap: 0;
}

.fdp-month {
  flex: 1;
  min-width: 0;
}

.fdp-months-sep {
  width: 1px;
  background: #f0f4f8;
  margin: 0 12px;
  align-self: stretch;
  flex-shrink: 0;
}

/* ── Month header ── */
.fdp-month-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  min-height: 26px;
}

.fdp-month-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.1px;
  text-align: center;
  flex: 1;
}

.fdp-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid #e8edf2;
  background: #fff;
  color: #64748b;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.13s ease;
  flex-shrink: 0;
}

.fdp-nav-btn:hover:not(:disabled) {
  border-color: #a5b4fc;
  background: #eef2ff;
  color: #4f46e5;
}

.fdp-nav-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.fdp-nav-spacer {
  width: 26px;
  flex-shrink: 0;
}

/* ── Weekday header ── */
.fdp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px;
}

.fdp-weekday {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #b0bec5;
  letter-spacing: 0.3px;
  padding: 2px 0 5px;
  text-transform: uppercase;
}

/* ── Days grid ── */
.fdp-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 1px;
}

/* ── Day cell ── */
.fdp-day {
  position: relative;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.fdp-day:focus-visible .fdp-day-circle {
  box-shadow: 0 0 0 2px #4f46e5;
}

/* Range strip background */
.fdp-day-bg {
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 30px;
  background: transparent;
  pointer-events: none;
  transition: background 0.1s ease;
}

/* Selection circle */
.fdp-day-circle {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
  transition: background 0.13s ease, transform 0.1s ease;
}

/* Day number + fare content */
.fdp-day-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 30px;
  height: 30px;
  justify-content: center;
}

.fdp-day-num {
  font-size: 12px;
  font-weight: 500;
  color: #1e293b;
  line-height: 1;
  transition: color 0.1s ease;
}

.fdp-day-fare {
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.1px;
}

.fdp-fare--cheap     { color: #16a34a; }
.fdp-fare--moderate  { color: #d97706; }
.fdp-fare--expensive { color: #dc2626; }

/* ── State: other month ── */
.fdp-day--other-month {
  opacity: 0.15;
  pointer-events: none;
}

/* ── State: disabled (past) ── */
.fdp-day--disabled {
  opacity: 0.22;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── State: today indicator ── */
.fdp-day--today .fdp-day-num {
  color: #4f46e5;
  font-weight: 700;
}

.fdp-day--today::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #4f46e5;
}

/* ── State: hover ── */
.fdp-day:not(.fdp-day--disabled):not(.fdp-day--range-start):not(.fdp-day--range-end):hover .fdp-day-circle {
  background: rgba(99, 102, 241, 0.08);
  transform: translateX(-50%) scale(1.04);
}

.fdp-day:not(.fdp-day--disabled):not(.fdp-day--range-start):not(.fdp-day--range-end):hover .fdp-day-num {
  color: #4f46e5;
  font-weight: 600;
}

/* ── State: in-range ── */
.fdp-day--in-range .fdp-day-bg {
  background: rgba(99, 102, 241, 0.07);
}

/* ── State: hover-range preview ── */
.fdp-day--hover-range .fdp-day-bg {
  background: rgba(99, 102, 241, 0.04);
}

/* ── State: range-start ── */
.fdp-day--range-start .fdp-day-bg {
  left: 50%;
  right: 0;
  background: rgba(99, 102, 241, 0.07);
  border-radius: 0;
}

.fdp-day--range-start .fdp-day-circle {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.fdp-day--range-start .fdp-day-num {
  color: #fff;
  font-weight: 700;
}

.fdp-day--range-start .fdp-day-fare {
  color: rgba(255, 255, 255, 0.72) !important;
}

.fdp-day--range-start::after { background: rgba(255, 255, 255, 0.6); }

/* ── State: range-end ── */
.fdp-day--range-end .fdp-day-bg {
  left: 0;
  right: 50%;
  background: rgba(99, 102, 241, 0.07);
  border-radius: 0;
}

.fdp-day--range-end .fdp-day-circle {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.fdp-day--range-end .fdp-day-num {
  color: #fff;
  font-weight: 700;
}

.fdp-day--range-end .fdp-day-fare {
  color: rgba(255, 255, 255, 0.72) !important;
}

.fdp-day--range-end::after { background: rgba(255, 255, 255, 0.6); }

/* Same day start + end — no range strip */
.fdp-day--range-start.fdp-day--range-end .fdp-day-bg {
  background: transparent !important;
  left: 0 !important;
  right: 0 !important;
}

/* ── Panel Footer ── */
.fdp-panel-ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 12px;
  margin-top: 6px;
  border-top: 1px solid #f0f4f8;
}

.fdp-legend {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fdp-legend-item {
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fdp-legend-item::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.fdp-legend--cheap::before    { background: #16a34a; }
.fdp-legend--cheap            { color: #16a34a; }
.fdp-legend--moderate::before { background: #d97706; }
.fdp-legend--moderate         { color: #d97706; }
.fdp-legend--expensive::before { background: #dc2626; }
.fdp-legend--expensive        { color: #dc2626; }

.fdp-ft-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fdp-clear-btn {
  height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.13s ease;
}

.fdp-clear-btn:hover {
  border-color: #c8d3de;
  background: #f8fafc;
  color: #334155;
}

.fdp-done-btn {
  height: 28px;
  padding: 0 14px;
  border-radius: 7px;
  border: none;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.26);
}

.fdp-done-btn:hover {
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.38);
  transform: translateY(-1px);
}

/* ── Micro: active press ── */
.fdp-day:not(.fdp-day--disabled):active .fdp-day-circle {
  transform: translateX(-50%) scale(0.92);
}

/* ── Return field disabled state ── */
.field-disabled .fdp-trigger {
  cursor: default;
  pointer-events: none;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */

@media (max-width: 768px) {
  .fdp-panel {
    position: fixed !important;
    top: auto !important;
    bottom: 0;
    left: 0 !important;
    right: 0;
    width: 100% !important;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    animation: fdp-slide-up 0.22s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
  }

  .fdp-month--right,
  .fdp-months-sep {
    display: none;
  }

  .fdp-calendars {
    padding: 16px 14px 0;
  }

  .fdp-day {
    height: 48px;
  }
}
