/* ---------------------------------
   Datepicker Custom Styles (Bootstrap-based)
---------------------------------- */

/* General container */
.datepicker {
  position: relative;
  border-radius: 0.5rem;
  max-width: 100%;
}

/* Calendar card */
.calendar {
  background-color: #fff;
  position: relative;
  top: 100%;
  z-index: 1003;
  overflow: hidden;
  padding: 1rem;
  border-radius: inherit;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  user-select: none;
  text-align: center;
  font-size: 0.9rem;
}

/* Dual calendar layout */
.calendar:not([hidden]) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Calendar controls */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls strong.label {
  flex: 1;
  text-align: center;
  font-weight: 600;
  text-transform: uppercase;
}

/* Day and date grids */
.days,
.dates {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: 0.5rem;
  width: 100%;
}

.days {
  font-weight: 600;
}

/* Date cells */
.dates span {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6c757d;
  z-index: 0;
}

.dates span::before {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: -1;
}

/* Hover effect */
.dates span:not(.in-range):not(.range-start):not(.range-end):hover::before {
  background-color: rgba(13, 110, 253, 0.1);
  border-radius: 50%;
}

/* Selected and in-range date text color */
.dates span.in-range,
.dates span.range-start,
.dates span.range-end {
  color: #fff;
}

/* Disabled dates */
.dates span.disabled {
  color: rgba(108, 117, 125, 0.35);
  pointer-events: none;
  cursor: default;
  background: none;
}

.dates span.disabled::before,
.dates span.disabled::after {
  content: none !important;
}

.dates span.disabled.in-range::before,
.dates span.disabled.range-start::before,
.dates span.disabled.range-end::before {
  content: none !important;
}

/* In-range dates */
.dates span.in-range::before {
  background-color: rgba(13, 110, 253, 0.5);
  border-radius: 0;
}

.dates span.range-start::before {
  background-color: rgba(13, 110, 253, 0.5);
  border-top-left-radius: 50%;
  border-bottom-left-radius: 50%;
}

.dates span.range-end::before {
  background-color: rgba(13, 110, 253, 0.5);
  border-top-right-radius: 50%;
  border-bottom-right-radius: 50%;
}

.dates span.range-start.range-end::before {
  border-radius: 50%;
}

/* Today's date */
.dates span.today {
  position: relative;
  color: #fff;
  z-index: 1;
}

.dates span.today::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(13, 202, 240, 0.9);
  border-radius: 50%;
  z-index: -1;

  box-shadow: 0 0 0 2px #fff;
}

/* Selected date */
.dates span.selection::before {
  background-color: #0d6efd;
}

/* Occupied date */
.dates span.occupied::before {
  background-color: rgba(220, 53, 69, 0.9);
}

/* Action menu */
.action-menu {
  grid-column: span 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.action-menu .selection {
  width: 100%;
  margin-bottom: 0.5rem;
  text-align: center;
}

.action-menu .buttons {
  width: 100%;
  justify-content: center;
}


.action-menu button:disabled {
  opacity: 0.65;
}

/* Pre-selected dates */
.pre-selected-dates {
  grid-column: span 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(0, 0, 0, 0.5);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

/* Selected dates text */
.selected {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.selected .fixed-part {
  flex-shrink: 0;
  white-space: nowrap;
}

.selected .changing-part {
  min-width: 20ch;
  white-space: nowrap;
  text-align: left;
}

/* Color legend */
.legend {
  grid-column: span 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.legend-dot {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
}

/* Responsive */
@media (max-width: 480px) {
  .calendar:not([hidden]) {
    display: flex;
    flex-direction: column;
  }

  .calendar .right-side {
    display: none !important;
  }

  .calendar .controls {
    flex-direction: row;
  }

  .calendar .mobile-only {
    display: inline-flex !important;
  }

  .calendar .action-menu {
    flex-direction: column;
  }
}
