/* monomo calendar component
   shared by book.css and manage.css
   uses brand.css tokens — mobile-first (375px base) */

/* ============================================
   calendar navigation
   ============================================ */

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.nav-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-size: 1.35rem;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s ease-in-out,
              opacity 0.2s ease-in-out;
}

@media (hover: hover) {
  .nav-btn:hover {
    border-color: var(--ink);
    opacity: 0.85;
  }
}

.nav-btn:active {
  opacity: 0.7;
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

#week-label {
  flex: 1;
  text-align: center;
  font-size: var(--text-body);
  font-weight: 500;
}

/* ============================================
   calendar grid
   ============================================ */

.calendar {
  margin-bottom: 16px;
  overflow: hidden;
}

.calendar .loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

/* mobile: vertical day list with horizontal slot scroll */
.calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.day-column {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  max-width: 100%;
  overflow: hidden;
}

.day-column:last-child {
  border-bottom: none;
}

.day-label {
  min-width: 62px;
  flex-shrink: 0;
}

.day-header {
  font-size: var(--text-caption);
  color: var(--muted);
  text-transform: lowercase;
  line-height: 1.2;
}

.day-date {
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.2;
}

.day-slots {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
  flex: 1;
  min-width: 0;
}

.day-slots::-webkit-scrollbar {
  display: none;
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-size: var(--text-caption);
  text-align: center;
  flex-shrink: 0;
  border-radius: 12px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s ease-in-out,
              background 0.25s ease-in-out,
              color 0.25s ease-in-out,
              opacity 0.25s ease-in-out;
}

@media (hover: hover) and (pointer: fine) {
  .slot:hover {
    border-color: var(--ink);
    background: var(--paper);
    opacity: 0.85;
  }
  .slot:not(.selected):not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  }
}

.slot:active {
  opacity: 0.7;
}

.slot.selected {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--white);
}

.slot .time {
  display: block;
  font-weight: 500;
}

.slot .price {
  display: block;
  font-size: var(--text-eyebrow);
  opacity: 0.6;
}

.no-slots {
  font-size: var(--text-caption);
  color: var(--muted);
  padding: 8px 0;
}

.no-slots.closed,
.no-slots.sold-out {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.no-slots.closed {
  background: rgba(22, 22, 22, 0.03);
}

.no-slots.sold-out {
  background: rgba(22, 22, 22, 0.08);
  color: var(--ink);
}

/* ============================================
   tablet and up (>= 600px)
   ============================================ */

@media (min-width: 600px) {
  /* desktop: auto-fit columns (7 on full weeks, fewer when late in week) */
  .calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 8px;
    max-width: 640px;
  }

  .day-column {
    flex-direction: column;
    text-align: center;
    border-bottom: none;
    padding: 0;
  }

  .day-label {
    min-width: unset;
  }

  .day-header {
    padding: 8px 0;
  }

  .day-date {
    padding-bottom: 8px;
  }

  .day-slots {
    flex-direction: column;
    overflow-x: visible;
    gap: 6px;
  }

  .slot {
    min-width: unset;
    width: 100%;
    min-height: 38px;
    padding: 9px 4px;
    border-radius: var(--radius-sm);
  }
}

/* wider desktop (>= 768px) */
@media (min-width: 768px) {
  .calendar-grid {
    gap: 12px;
  }
}

@media (max-width: 440px) {
  .day-label {
    min-width: 58px;
  }

  .slot {
    min-width: 82px;
    padding: 8px 14px;
  }
}

/* ============================================
   retina / HiDPI refinements
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .slot {
    border-width: 0.5px;
  }

  .day-column {
    border-bottom-width: 0.5px;
  }

  .nav-btn {
    border-width: 0.5px;
  }
}
