/* mousing: custom styles (Tailwind CDN handles the rest) */

/* System font stack */
html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Month multi-select button */
.month-btn {
  width: 100%;
  padding: 0.5rem 0.75rem;
  padding-right: 2rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  outline: none;
  text-align: left;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  color: #111827;
}
.month-btn:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
.month-btn.placeholder {
  color: #9ca3af;
}
/* Room for the clear button, which sits just left of the chevron. */
.month-btn.has-value {
  padding-right: 4.25rem;
}

/* Clear "x" for a dropdown: a sibling of the field, spanning its full height
   so the icon stays vertically centered at any field size. */
.clear-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 1.75rem;
  width: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  border-radius: 9999px;
}
.clear-btn:hover {
  color: #4b5563;
}
.clear-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -4px;
}

/* Primary search action: solid fill and shadow set it apart from the outlined filter controls. */
.search-btn {
  background: #1d4ed8;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.12), 0 4px 10px -2px rgba(29, 78, 216, 0.45);
  letter-spacing: 0.01em;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease-out;
}
@media (hover: hover) and (pointer: fine) {
  .search-btn:hover:not(:disabled) {
    background: #1e40af;
  }
}
.search-btn:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.12);
}
.search-btn:disabled {
  box-shadow: none;
}
@media (prefers-reduced-motion: reduce) {
  .search-btn:active:not(:disabled) {
    transform: none;
  }
}

/* Date range calendar (watch editor). Each cell carries the range band;
   the inner dot marks the first and last night. */
.range-cell {
  position: relative;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.range-cell.band-mid {
  background: #eff6ff;
}
.range-cell.band-start {
  background: linear-gradient(to right, transparent 50%, #eff6ff 50%);
}
.range-cell.band-end {
  background: linear-gradient(to left, transparent 50%, #eff6ff 50%);
}
.range-cell.is-preview.band-mid {
  background: #f3f4f6;
}
.range-cell.is-preview.band-start {
  background: linear-gradient(to right, transparent 50%, #f3f4f6 50%);
}
.range-cell.is-preview.band-end {
  background: linear-gradient(to left, transparent 50%, #f3f4f6 50%);
}
.range-day {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  color: #111827;
  transition: background-color 0.12s ease, color 0.12s ease;
}
@media (hover: hover) and (pointer: fine) {
  .range-day:hover:not(:disabled):not(.is-endpoint) {
    background: #dbeafe;
  }
}
.range-day:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}
.range-day.is-today {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.range-day.is-endpoint {
  background: #1d4ed8;
  color: #fff;
  font-weight: 600;
}
.range-day:disabled {
  color: #d1d5db;
  cursor: not-allowed;
}

/* Collapsible contract advice on the alert page */
.contract-panel > summary {
  list-style: none;
}
.contract-panel > summary::-webkit-details-marker {
  display: none;
}
.contract-chevron {
  transition: transform 0.15s ease-out;
}
.contract-panel[open] .contract-chevron {
  transform: rotate(180deg);
}

/* Calendar day cells */
.cal-day {
  min-height: 4.5rem;
  padding: 0.375rem;
  border-radius: 0.5rem;
  border: 1px solid #f3f4f6;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
}
.cal-day.available {
  border-left: 3px solid #10b981;
  background: #f0fdf4;
  cursor: pointer;
}
.cal-day.available:hover {
  background: #dcfce7;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.cal-day.unavailable {
  background: #fafafa;
  opacity: 0.5;
}
.cal-day.empty {
  border: none;
  background: transparent;
  min-height: 0;
}

/* Calendar result filters are independent from the room types used to run a search. */
.result-filter-pill {
  min-height: 2rem;
  padding: 0.375rem 0.625rem;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  background: #fff;
  color: #4b5563;
  font-size: 0.75rem;
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.result-filter-pill:hover {
  border-color: #9ca3af;
}
.result-filter-pill.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}
.result-filter-stat {
  color: #9ca3af;
  font-weight: 500;
}
.result-filter-resort {
  padding: 0.0625rem 0.25rem;
  border-radius: 0.25rem;
  background: #f3e8ff;
  color: #7e22ce;
  font-size: 0.625rem;
  letter-spacing: 0.02em;
}
.result-filter-view {
  overflow: hidden;
  max-width: 11rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-filter-pill.is-active .result-filter-stat {
  color: #60a5fa;
}
.room-type-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
}

/* A lane represents a broad type; its streak length is calculated from an exact room code. */
.room-track-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 0.25rem;
}
.room-track {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  height: 0.75rem;
  padding: 0 0.1875rem;
  border-radius: 0.1875rem;
  color: #fff;
  font-size: 0.5rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.room-track > span {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-track > strong {
  flex-shrink: 0;
  margin-left: 2px;
}
.room-track.continues-prev::before,
.room-track.continues-next::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0.375rem;
  background: inherit;
  content: "";
}
.room-track.continues-prev::before { left: -0.375rem; }
.room-track.continues-next::after { right: -0.375rem; }
.room-track-color-0 { background-color: #2563eb; }
.room-track-color-1 { background-color: #6d28d9; }
.room-track-color-2 { background-color: #be185d; }
.room-track-color-3 { background-color: #b45309; }
.room-track-color-4 { background-color: #0e7490; }
.room-track-color-5 { background-color: #4f46e5; }

/* Auth pulse animation */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.pulse-dot {
  animation: pulse-dot 2s ease-in-out infinite;
}

/* Spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-sm {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Bottom sheet modal for mobile */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
  }
}
.modal-sheet {
  background: white;
  width: 100%;
  max-width: 28rem;
  border-radius: 1rem 1rem 0 0;
  padding: 1.5rem;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(0);
  transition: transform 0.2s ease;
}
@media (min-width: 640px) {
  .modal-sheet {
    border-radius: 1rem;
  }
}

/* ========== Touch optimizations for tablets and phones (portrait) ========== */
@media (max-width: 1024px) {
  /* Dropdown trigger buttons — min 44px touch target */
  .month-btn {
    min-height: 2.75rem; /* 44px */
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    font-size: 0.9375rem;
  }

  /* Dropdown checkbox rows — 44px min height */
  [data-resort-dropdown] label,
  [data-month-dropdown] label {
    padding: 0.75rem;
    gap: 0.75rem;
    font-size: 0.9375rem;
    min-height: 2.75rem;
  }

  /* Checkboxes inside dropdowns — bigger tap target */
  [data-resort-dropdown] input[type="checkbox"],
  [data-month-dropdown] input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
  }

  /* Room type pill buttons — taller for touch */
  .room-type-pill {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }

  .result-filter-pill {
    min-height: 2.75rem;
    padding: 0.5rem 0.875rem;
  }

  /* Clear "x" buttons on dropdowns — 44px wide tap target; height follows the field */
  .clear-btn {
    width: 2.75rem;
  }
  .month-btn.has-value {
    padding-right: 4.75rem;
  }

  /* Modal close button — bigger tap target */
  .modal-sheet button[class*="p-1"] {
    padding: 0.5rem;
  }

  /* Modal view list items — more padding */
  .modal-sheet .space-y-2 > div {
    padding: 1rem;
  }

  /* Auth badge — 44px min height */
  header button[class*="rounded-full"] {
    min-height: 2.75rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Mobile nav icon links — 44px tap target */
  header nav + div a,
  header .sm\\:hidden a {
    padding: 0.625rem;
  }

  /* Search button — ensure 44px */
  button[class*="bg-blue-600"] {
    min-height: 2.75rem;
  }

  /* Accessible checkbox row — bigger tap area */
  label[class*="inline-flex"] {
    padding: 0.375rem 0;
    gap: 0.5rem;
  }
  label[class*="inline-flex"] input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
  }
}

/* Smooth transitions on page load */
[x-cloak] { display: none !important; }
