/* 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-default);
  background: var(--light);
  cursor: pointer;
  font-size: var(--text-h3);
  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 var(--transition),
              opacity var(--transition);
}

@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: var(--weight-semi);
}

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

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

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

/* 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-default);
  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(--selenium);
  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-default);
  background: var(--light);
  cursor: pointer;
  font-size: var(--text-caption);
  text-align: center;
  flex-shrink: 0;
  border-radius: var(--radius-input);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--transition),
              background var(--transition),
              color var(--transition),
              opacity var(--transition);
}

@media (hover: hover) and (pointer: fine) {
  .slot:hover {
    border-color: var(--ink);
    background: var(--bg-surface);
    opacity: 0.85;
  }
  .slot:not(.selected):not(:disabled):hover {
    transform: translateY(-1px);
  }
}

.slot:active {
  opacity: 0.7;
}

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

.slot .time {
  display: block;
  font-weight: var(--weight-semi);
}

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

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

.no-slots.closed,
.no-slots.sold-out {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-default);
  width: 100%;
}

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

.no-slots.sold-out {
  background: rgba(0, 0, 0, 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: 10px;
    max-width: 720px;
    margin: 0 auto;
  }

  .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;
    align-items: stretch;
    overflow-x: visible;
    gap: 6px;
  }

  .slot {
    min-width: unset;
    width: 100%;
    min-height: 44px;
    padding: 12px 4px;
    border-radius: var(--radius-input);
  }
}

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

@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;
  }
}
