/*
 * Application-wide styles
 * With Propshaft, this file is served directly without compilation
 */

/* Calendar Dense Mode */
.calendar--dense [data-unit-row] {
  height: 2.5rem !important; /* 40px instead of 64px */
}

.calendar--dense [data-calendar-part="unit-names"] .h-16:not(.calendar-unit-header) {
  height: 2.5rem !important;
}

.calendar--dense [data-calendar-part="unit-names"] .calendar-unit-header {
  height: 4rem !important; /* Keep header height consistent */
}

.calendar--dense [data-calendar-cell="grid"] {
  width: 3rem !important; /* 48px on mobile, stays same on desktop */
}

@media (min-width: 768px) {
  .calendar--dense [data-calendar-cell="grid"],
  .calendar--dense [data-calendar-cell="date"] {
    width: 6rem !important; /* 96px instead of 128px on desktop */
  }
}

.calendar--dense [data-calendar-cell="grid"] > div,
.calendar--dense [data-calendar-cell="grid"] > div > div {
  height: 1.75rem !important; /* 28px instead of 48px */
  top: 0.25rem !important;
  padding-left: 0.25rem !important;
  padding-right: 0.25rem !important;
}

/* Hide reservation number and price details in dense mode */
.calendar--dense .calendar-res-number,
.calendar--dense .calendar-res-details {
  display: none !important;
}

/* Adjust text sizing in dense mode */
.calendar--dense .calendar-res-name {
  font-size: 8px !important;
  line-height: 1.2 !important;
}

@media (min-width: 768px) {
  .calendar--dense .calendar-res-name {
    font-size: 10px !important;
  }
}

/* TomSelect adjustments for Calendar Header */
[data-controller="calendar-density"] .ts-wrapper.ts-sm .ts-control {
  min-height: 2rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

[data-controller="calendar-density"] .ts-wrapper.ts-sm .ts-control::after {
  right: 0.5rem;
}

[data-controller="calendar-density"] .ts-wrapper.ts-sm .ts-control input {
  font-size: 0.75rem;
}

/* TomSelect dropdown styling for calendar property selector */
.calendar-property-select + .ts-wrapper .ts-dropdown {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  margin-top: 4px;
  z-index: 9999 !important;
  position: absolute !important;
}

.dark .calendar-property-select + .ts-wrapper .ts-dropdown {
  background: #1f2937;
  border-color: #374151;
}

.calendar-property-select + .ts-wrapper .ts-dropdown .ts-dropdown-content {
  background: white;
  padding: 4px;
}

.dark .calendar-property-select + .ts-wrapper .ts-dropdown .ts-dropdown-content {
  background: #1f2937;
}

.calendar-property-select + .ts-wrapper .ts-dropdown .option,
.calendar-property-select + .ts-wrapper .ts-dropdown .ts-option-item {
  background: white;
  padding: 8px 12px;
  border-radius: 6px;
  margin: 2px 0;
  color: #1f2937;
  font-size: 12px;
  font-weight: 500;
}

.dark .calendar-property-select + .ts-wrapper .ts-dropdown .option,
.dark .calendar-property-select + .ts-wrapper .ts-dropdown .ts-option-item {
  background: #374151;
  color: white;
}

.calendar-property-select + .ts-wrapper .ts-dropdown .option:hover,
.calendar-property-select + .ts-wrapper .ts-dropdown .option.active,
.calendar-property-select + .ts-wrapper .ts-dropdown .ts-option-item:hover {
  background: #f3f4f6;
  color: #6366f1;
}

.dark .calendar-property-select + .ts-wrapper .ts-dropdown .option:hover,
.dark .calendar-property-select + .ts-wrapper .ts-dropdown .option.active,
.dark .calendar-property-select + .ts-wrapper .ts-dropdown .ts-option-item:hover {
  background: #4b5563;
  color: #818cf8;
}

/* Mobile calendar touch scrolling fixes */
[data-calendar-part="date-scroll"] {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

@media (max-width: 767px) {
  /* Ensure smooth horizontal scrolling on mobile */
  [data-calendar-part="date-scroll"] {
    scroll-snap-type: x proximity;
  }

  /* Prevent sticky column from interfering with touch scroll */
  [data-unit-row] .sticky {
    touch-action: none;
  }

  /* Prevent overscroll on calendar container */
  #calendar_grid {
    overscroll-behavior: contain;
  }
}
