/* Creek Motors — Custom Calendar Widget
   Professional themed date picker matching the Creek Motors brand.
   Features: affordability coloring, single-month view, color key legend, year picker for DOB. */

.creek-cal {
  position: fixed;
  z-index: 100000;
  width: 380px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(5, 11, 32, 0.18), 0 2px 8px rgba(5, 11, 32, 0.08);
  font-family: "Inter", sans-serif;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  padding: 0;
  overflow: hidden;
}

.creek-cal.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Panels container ── */
.creek-cal-panels {
  display: flex;
  gap: 0;
}

.creek-cal-panel {
  flex: 1;
  min-width: 0;
}

/* ── Top navigation (prev/next buttons above panels) ── */
.creek-cal-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  background: linear-gradient(135deg, #050B20 0%, #0F1A3D 100%);
  gap: 8px;
}

.creek-cal-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  opacity: 0.95;
}

/* ── Month panel header ── */
.creek-cal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px 10px;
  background: #fff;
  border-bottom: 1px solid #F0F2F8;
}

.creek-cal-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.creek-cal-month {
  font-family: "Outfit", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1;
  color: #050B20;
}

.creek-cal-year-btn {
  font-size: 11px;
  font-weight: 400;
  color: #9499A8;
  letter-spacing: 1px;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.creek-cal-year-btn:hover {
  background: #F0F2F8;
  color: #050B20;
}

.creek-cal-nav {
  display: flex;
  gap: 8px;
}

.creek-cal-nav-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.creek-cal-nav-btn:hover {
  background: var(--color-primary, #FF3600);
  border-color: var(--color-primary, #FF3600);
}

.creek-cal-nav-btn:active {
  transform: scale(0.92);
}

/* ── Weekday row ── */
.creek-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 8px 12px 2px;
  gap: 0;
}

.creek-cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #9499A8;
  padding: 4px 0;
}

/* ── Days grid ── */
.creek-cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 12px 10px;
  gap: 2px;
}

.creek-cal-day {
  aspect-ratio: auto;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 500;
  color: #050B20;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  border: none;
  background: transparent;
  padding: 0;
}

.creek-cal-day:hover:not(.disabled):not(.selected) {
  filter: brightness(0.92);
  transform: scale(1.05);
}

.creek-cal-day.other-month {
  color: #C8CCD6;
  opacity: 0.5;
}

.creek-cal-day.today {
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--color-primary, #FF3600);
}

.creek-cal-day.today::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-primary, #FF3600);
}

/* ── Affordability colors ── */
.creek-cal-day.afford-cheap {
  background: #E8F8EE;
  color: #1B7A3F;
}

.creek-cal-day.afford-medium {
  background: #FFF4E0;
  color: #B8730C;
}

.creek-cal-day.afford-high {
  background: #FDE8EF;
  color: #C2185B;
}

/* ── Selected (highest priority — overrides affordability) ── */
.creek-cal-day.selected {
  background: #050B20 !important;
  color: #fff !important;
  font-weight: 700;
}

.creek-cal-day.selected::after {
  display: none;
}

.creek-cal-day.disabled {
  color: #E0E3EB;
  cursor: not-allowed;
  background: transparent !important;
}

.creek-cal-day.disabled.afford-cheap,
.creek-cal-day.disabled.afford-medium,
.creek-cal-day.disabled.afford-high {
  background: transparent !important;
  color: #E0E3EB !important;
}

.creek-cal-day.in-range {
  background: #FFF0EB;
  color: var(--color-primary, #FF3600);
  border-radius: 10px;
}

/* ── Year Picker ── */
.creek-cal-year-picker {
  padding: 20px;
}

.creek-cal-yp-header {
  text-align: center;
  padding: 8px 0 16px;
}

.creek-cal-yp-range {
  font-family: "Outfit", sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #050B20;
  letter-spacing: 0.3px;
}

.creek-cal-yp-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.creek-cal-yp-year {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #050B20;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: #F5F6FA;
  padding: 0;
}

.creek-cal-yp-year:hover:not(.disabled):not(.selected) {
  background: #E8EAF2;
  transform: scale(1.05);
}

.creek-cal-yp-year.selected {
  background: #050B20 !important;
  color: #fff !important;
  font-weight: 700;
}

.creek-cal-yp-year.disabled {
  color: #E0E3EB;
  background: transparent !important;
  cursor: not-allowed;
}

/* ── Legend / Color Key ── */
.creek-cal-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid #EEF0F5;
  background: #FAFBFD;
}

.creek-cal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #6B7280;
  white-space: nowrap;
}

.creek-cal-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

.creek-legend-cheap {
  background: #E8F8EE;
  border: 1px solid #C8EBD6;
}

.creek-legend-medium {
  background: #FFF4E0;
  border: 1px solid #F0DCAE;
}

.creek-legend-high {
  background: #FDE8EF;
  border: 1px solid #F5C5D5;
}

.creek-legend-selected {
  background: #050B20;
  border: 1px solid #050B20;
}

/* ── Time picker ── */
.creek-cal-time-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-top: 1px solid #EEF0F5;
  background: #FAFBFD;
}
.creek-cal-time-label {
  font-size: 12px;
  font-weight: 600;
  color: #061B3C;
  white-space: nowrap;
}
.creek-cal-time-select {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: #061B3C;
  border: 1px solid #DDE1EC;
  border-radius: 8px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
  background: #fff;
  appearance: auto;
  -webkit-appearance: auto;
}
.creek-cal-time-select:focus {
  border-color: var(--color-primary, #FF3600);
}

/* ── Footer ── */
.creek-cal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 14px;
  border-top: 1px solid #EEF0F5;
}

.creek-cal-today-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary, #FF3600);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.2s ease;
  letter-spacing: 0.3px;
}

.creek-cal-today-btn:hover {
  background: #FFF0EB;
}

.creek-cal-close-btn {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.2s ease;
  letter-spacing: 0.3px;
}

.creek-cal-close-btn:hover {
  background: #F6F6F6;
}

/* ── Mobile / small screens (<768px) — single month, fill available space ── */
@media (max-width: 767px) {
  .creek-cal {
    width: calc(100vw - 24px);
    max-width: 380px;
    left: 50% !important;
    transform: translateX(-50%) translateY(-8px) scale(0.97);
    border-radius: 18px;
  }

  .creek-cal.open {
    transform: translateX(-50%) translateY(0) scale(1);
  }

  /* Top nav — bigger touch targets */
  .creek-cal-top-nav {
    padding: 18px 24px 14px;
  }

  .creek-cal-logo {
    height: 24px;
    max-width: 120px;
    border-radius: 6px;
    padding: 4px 8px;
  }

  .creek-cal-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 18px;
  }

  /* Month header — larger, centered */
  .creek-cal-header {
    padding: 14px 20px 12px;
  }

  .creek-cal-month {
    font-size: 22px;
    font-weight: 800;
  }

  .creek-cal-year-btn {
    font-size: 13px;
    letter-spacing: 1.5px;
  }

  /* Weekday row — bigger labels */
  .creek-cal-weekdays {
    padding: 10px 16px 4px;
  }

  .creek-cal-weekday {
    font-size: 13px;
    font-weight: 700;
    padding: 6px 0;
  }

  /* Days grid — fill width, bigger cells */
  .creek-cal-days {
    padding: 0 16px 14px;
    gap: 4px;
  }

  .creek-cal-day {
    font-size: 17px;
    font-weight: 600;
    border-radius: 8px;
    aspect-ratio: auto;
    min-height: 48px;
  }

  .creek-cal-day.today::after {
    width: 6px;
    height: 6px;
    bottom: 4px;
  }

  /* Year picker — bigger cells on mobile */
  .creek-cal-year-picker {
    padding: 24px 20px;
  }

  .creek-cal-yp-range {
    font-size: 22px;
    font-weight: 800;
  }

  .creek-cal-yp-grid {
    gap: 8px;
  }

  .creek-cal-yp-year {
    font-size: 17px;
    font-weight: 600;
    min-height: 52px;
    border-radius: 10px;
  }

  /* Legend — larger, more readable */
  .creek-cal-legend {
    gap: 14px;
    padding: 14px 20px;
  }

  .creek-cal-legend-item {
    font-size: 12px;
    gap: 6px;
  }

  .creek-cal-legend-dot {
    width: 14px;
    height: 14px;
  }

  /* Footer — bigger touch targets */
  .creek-cal-footer {
    padding: 14px 24px 18px;
  }

  .creek-cal-today-btn,
  .creek-cal-close-btn {
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 10px;
  }
}

/* ── Very small screens (≤380px) ── */
@media (max-width: 380px) {
  .creek-cal {
    width: calc(100vw - 16px);
    max-width: 340px;
  }

  .creek-cal-day {
    font-size: 15px;
    border-radius: 6px;
    min-height: 42px;
  }

  .creek-cal-month {
    font-size: 20px;
  }

  .creek-cal-weekday {
    font-size: 12px;
  }

  .creek-cal-logo {
    height: 20px;
    max-width: 90px;
    padding: 3px 6px;
    border-radius: 5px;
  }

  .creek-cal-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .creek-cal-days {
    gap: 3px;
    padding: 0 12px 12px;
  }

  .creek-cal-weekdays {
    padding: 8px 12px 4px;
  }

  .creek-cal-yp-year {
    font-size: 15px;
    min-height: 46px;
    border-radius: 8px;
  }

  .creek-cal-yp-range {
    font-size: 20px;
  }
}
