/**
 * Flatpickr Custom Theme - Cosmokod Panel
 * Lighter, modern styling matching the indigo theme
 */

/* ===== CALENDAR CONTAINER ===== */
.flatpickr-calendar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  width: 300px !important;
}

.flatpickr-calendar.hasTime .flatpickr-time {
  border-top: 1px solid #e2e8f0;
}

/* ===== HEADER / MONTH NAVIGATION ===== */
.flatpickr-months {
  background: #f8fafc;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flatpickr-months .flatpickr-month {
  height: auto;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flatpickr-month {
  color: #1e293b;
  fill: #1e293b;
}

.flatpickr-current-month {
  color: #1e293b;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  height: auto !important;
  line-height: normal !important;
  padding: 4px 0;
  position: static !important;
  transform: none !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.flatpickr-current-month .flatpickr-monthDropdown-months option {
  background: #ffffff;
  color: #1e293b;
}

.flatpickr-current-month .numInputWrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px 6px;
  min-width: 60px;
  width: auto !important;
  height: auto !important;
}

.flatpickr-current-month input.cur-year {
  color: #1e293b;
  font-weight: 600;
  background: transparent;
  padding: 2px 4px;
  font-size: 14px;
  height: auto !important;
  line-height: normal !important;
  width: 48px !important;
  display: inline-block !important;
}

.flatpickr-current-month .numInputWrapper span.arrowUp,
.flatpickr-current-month .numInputWrapper span.arrowDown {
  display: block !important;
}

.flatpickr-current-month span.cur-month {
  display: inline-block !important;
  margin: 0 4px;
  font-weight: 600;
}

/* ===== NAVIGATION ARROWS ===== */
.flatpickr-prev-month,
.flatpickr-next-month {
  color: #64748b !important;
  fill: #64748b !important;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  position: relative;
  height: 28px;
  width: 28px;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.flatpickr-prev-month:hover,
.flatpickr-next-month:hover {
  background: #e2e8f0;
  color: #1e293b !important;
}

.flatpickr-prev-month svg,
.flatpickr-next-month svg {
  width: 14px;
  height: 14px;
}

/* ===== WEEKDAY HEADERS ===== */
.flatpickr-weekdays {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 0;
  width: 100%;
}

.flatpickr-weekdaycontainer {
  width: 100% !important;
  display: flex !important;
}

span.flatpickr-weekday {
  color: #64748b;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
  text-align: center;
}

/* ===== CALENDAR DAYS ===== */
.flatpickr-days {
  padding: 8px;
  background: #ffffff;
  width: 100% !important;
}

.dayContainer {
  min-width: 100% !important;
  max-width: 100% !important;
  width: 100% !important;
}

.flatpickr-day {
  color: #1e293b;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.15s ease;
  border: 2px solid transparent;
  height: 38px;
  line-height: 38px;
  max-height: 38px;
  max-width: 38px;
  flex-basis: 14.285% !important;
  margin: 0;
  font-size: 13px;
}

.flatpickr-day:hover:not(.flatpickr-disabled) {
  background: #f1f5f9;
  border-color: transparent;
  color: #0f172a;
}

/* ===== TODAY ===== */
.flatpickr-day.today {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
  font-weight: 700;
}

.flatpickr-day.today:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
  color: #6366f1;
}

/* ===== SELECTED DATE ===== */
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
  background: #6366f1 !important;
  border-color: #6366f1 !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

/* ===== IN RANGE DATES ===== */
.flatpickr-day.inRange {
  background: rgba(99, 102, 241, 0.08);
  border-color: transparent;
  box-shadow: none;
  color: #6366f1;
}

/* ===== DISABLED DATES ===== */
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
  color: #cbd5e1;
  cursor: not-allowed;
  background: transparent;
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: #cbd5e1;
}

.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover {
  color: #94a3b8;
  background: #f8fafc;
}

/* ===== TIME PICKER ===== */
.flatpickr-time {
  border-top: 1px solid #e2e8f0;
  padding: 12px 16px 14px 16px;
  background: #f8fafc;
  border-radius: 0 0 12px 12px;
  height: auto !important;
  max-height: none !important;
  overflow: visible;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.flatpickr-time .numInputWrapper {
  height: auto !important;
  flex: 0 0 auto !important;
}

.flatpickr-time-separator,
.flatpickr-am-pm {
  color: #475569;
  font-weight: 600;
  font-size: 13px;
  line-height: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 3px;
}

.flatpickr-time input {
  color: #6366f1;
  font-weight: 700;
  font-size: 15px;
  background: #ffffff;
  border-radius: 6px;
  padding: 8px;
  height: 36px !important;
  margin: 0;
  line-height: 1.4;
  /* width: 42px !important; */
  box-sizing: border-box;
  text-align: center;
}

.flatpickr-time input:hover {
  background: rgba(99, 102, 241, 0.05);
}

.flatpickr-time input:focus {
  background: rgba(99, 102, 241, 0.08);
}

.numInputWrapper {
  position: relative;
  height: auto !important;
}

.numInputWrapper span {
  border: none;
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: 0 4px;
  height: 50%;
  line-height: 50%;
  cursor: pointer;
  width: 14px;
  right: 0;
}

.numInputWrapper:hover {
  background: transparent;
}

.numInputWrapper span:hover {
  opacity: 1;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 4px;
}

.numInputWrapper span.arrowUp {
  top: 0;
}

.numInputWrapper span.arrowDown {
  bottom: 0;
}

.numInputWrapper span.arrowUp:after {
  border-bottom-color: #6366f1;
}

.numInputWrapper span.arrowDown:after {
  border-top-color: #6366f1;
}

/* ===== INPUT STYLING ===== */
.form-control.flatpickr-input {
  cursor: pointer;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-control.flatpickr-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.15);
}

.form-control.flatpickr-input.active {
  border-color: #6366f1;
}

/* ===== ANIMATIONS ===== */
.flatpickr-calendar.animate.open {
  animation: flatpickrFadeInUp 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes flatpickrFadeInUp {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .flatpickr-calendar {
    font-size: 13px;
    width: 320px !important;
  }

  .flatpickr-day {
    height: 36px;
    line-height: 36px;
    max-height: 36px;
    max-width: 36px;
  }

  .flatpickr-months {
    padding: 10px 8px;
  }

  .flatpickr-current-month {
    font-size: 14px;
  }

  .flatpickr-time {
    padding: 10px 12px;
  }

  .flatpickr-time input {
    font-size: 14px;
    width: 40px !important;
    padding: 6px;
  }
}
