/* Schedule / Daytimer + Buyer Schedule Grid + Booking Modal */

/* Doer Daytimer page */
.schedule-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--stroke, #e0d6cc);
  flex-wrap: wrap;
}
.schedule-date {
  font-family: var(--font-display, serif);
  font-size: 18px;
  font-weight: 650;
  min-width: 200px;
  text-align: center;
}
.schedule-timeline {
  overflow-y: auto;
  max-height: calc(100vh - 220px);
  padding: 0 4px;
}
.schedule-loading {
  text-align: center;
  padding: 40px;
  color: var(--muted, #888);
}
.schedule-grid { position: relative; }
.schedule-row {
  position: absolute;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 64px 1fr;
  border-bottom: 1px solid var(--stroke-light, #f0ebe5);
}
.schedule-row-available {
  background: color-mix(in srgb, var(--c-success, #4caf50) 5%, transparent);
}
.schedule-time-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #888);
  padding: 4px 8px 0 0;
  text-align: right;
  user-select: none;
}
.schedule-slot { position: relative; }
.schedule-booking {
  position: absolute;
  left: 68px;
  right: 8px;
  border-radius: 10px;
  background: var(--card, #fffcf8);
  border: 1.5px solid var(--c-caramel, #b08463);
  padding: 8px 12px;
  cursor: pointer;
  overflow: hidden;
  z-index: 2;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: border-color .15s, box-shadow .15s;
}
.schedule-booking:hover {
  border-color: var(--c-espresso, #3e2723);
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
}
.schedule-booking-title {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-booking-meta {
  font-size: 11px;
  color: var(--muted, #888);
  display: flex;
  gap: 4px;
  margin-top: 2px;
}
.schedule-week-grid {
  display: grid;
  grid-template-columns: 44px repeat(7, 1fr);
  gap: 0;
}
.schedule-week-header {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 8px 2px;
  border-bottom: 1px solid var(--stroke, #e0d6cc);
  position: sticky;
  top: 0;
  background: var(--bg, #fff);
  z-index: 3;
}
.schedule-week-time {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted, #888);
  padding: 4px 4px 0 0;
  text-align: right;
  height: 40px;
  border-bottom: 1px solid var(--stroke-light, #f0ebe5);
}
.schedule-week-cell {
  height: 40px;
  border-bottom: 1px solid var(--stroke-light, #f0ebe5);
  border-right: 1px solid var(--stroke-light, #f0ebe5);
  position: relative;
  padding: 2px;
}
.schedule-week-cell-avail {
  background: color-mix(in srgb, var(--c-success, #4caf50) 4%, transparent);
}
.schedule-week-block {
  display: block;
  border-radius: 4px;
  background: var(--c-caramel, #b08463);
  opacity: 0.75;
  width: 100%;
  min-height: 10px;
  height: 100%;
  cursor: pointer;
  text-decoration: none;
}
.schedule-week-block:hover { opacity: 1; }

@media (max-width: 860px) {
  .schedule-nav { gap: 6px; }
  .schedule-date { font-size: 15px; min-width: auto; order: -1; width: 100%; }
}
@media (max-width: 560px) {
  .schedule-week-grid { grid-template-columns: 32px repeat(7, 1fr); }
  .schedule-week-time { font-size: 9px; }
  .schedule-week-header { font-size: 10px; padding: 4px 1px; }
  .schedule-booking { left: 58px; right: 4px; padding: 6px 8px; }
  .schedule-row { grid-template-columns: 52px 1fr; }
}

/* Doer Schedule Grid on helper profile */
.doer-schedule-table {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  gap: 0;
  border: 1px solid var(--stroke, #e0d6cc);
  border-radius: var(--radius, 12px);
  overflow: hidden;
}
.doer-schedule-cell {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--stroke-light, #f0ebe5);
  border-right: 1px solid var(--stroke-light, #f0ebe5);
  font-size: 12px;
  position: relative;
}
.doer-schedule-corner { background: var(--glass-50, #faf7f3); }
.doer-schedule-day-header {
  background: var(--glass-50, #faf7f3);
  font-weight: 700;
  font-size: 11px;
  text-align: center;
  line-height: 1.3;
}
.doer-schedule-row-label {
  background: var(--glass-50, #faf7f3);
  font-weight: 600;
  font-size: 11px;
  padding: 0 8px;
  justify-content: flex-end;
}
.doer-schedule-range {
  font-weight: 600;
  font-size: 14px;
}

/* Slot states */
.doer-slot-open {
  background: color-mix(in srgb, var(--c-success, #4caf50) 12%, white);
  border-color: color-mix(in srgb, var(--c-success, #4caf50) 30%, transparent);
  cursor: pointer;
  transition: background .15s;
}
.doer-slot-open:hover {
  background: color-mix(in srgb, var(--c-success, #4caf50) 25%, white);
}
.doer-slot-plus {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-success, #4caf50);
  opacity: 0.6;
}
.doer-slot-open:hover .doer-slot-plus { opacity: 1; }

.doer-slot-unavail {
  background: var(--glass-50, #faf7f3);
  background-image: repeating-linear-gradient(135deg, transparent, transparent 4px, color-mix(in srgb, var(--stroke-light, #e0d6cc) 50%, transparent) 4px, color-mix(in srgb, var(--stroke-light, #e0d6cc) 50%, transparent) 5px);
}
.doer-slot-booked {
  background: color-mix(in srgb, var(--c-espresso, #3e2723) 12%, var(--glass-50, #faf7f3));
  background-image: repeating-linear-gradient(135deg, transparent, transparent 4px, color-mix(in srgb, var(--stroke, #e0d6cc) 40%, transparent) 4px, color-mix(in srgb, var(--stroke, #e0d6cc) 40%, transparent) 5px);
}

/* Legend */
.doer-schedule-legend {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  font-size: 12px;
  color: var(--muted, #888);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--stroke-light, #e0d6cc);
}

/* Booking modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--card, #fffcf8);
  border-radius: var(--radius, 12px);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--stroke-light, #f0ebe5);
}
.modal-header h3 { margin: 0; font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted, #888);
  padding: 0 4px;
}
.modal-close:hover { color: var(--c-espresso, #3e2723); }
.modal-body { padding: 20px; }
.booking-slot-label {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--c-espresso, #3e2723);
}
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* AI suggestions */
.ai-suggestions {
  margin-top: 12px;
  padding: 12px;
  background: var(--glass-50, #faf7f3);
  border-radius: 10px;
}
.ai-suggestions-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #888);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.ai-suggestion-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: var(--card, #fffcf8);
  border: 1px solid var(--stroke-light, #f0ebe5);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  transition: border-color .15s;
}
.ai-suggestion-chip:hover {
  border-color: var(--c-caramel, #b08463);
}
.ai-suggestion-time { font-weight: 600; flex: 1; }
.ai-suggestion-reason { color: var(--muted, #888); font-size: 11px; flex: 2; }
.ai-suggestion-score {
  font-weight: 700;
  font-size: 12px;
  color: var(--c-success, #4caf50);
  min-width: 36px;
  text-align: right;
}

/* Responsive */
@media (max-width: 560px) {
  .doer-schedule-table { grid-template-columns: 60px repeat(7, 1fr); }
  .doer-schedule-row-label { font-size: 10px; padding: 0 4px; }
  .doer-schedule-day-header { font-size: 10px; }
  .modal-box { max-width: 100%; }
  .form-actions { flex-direction: column; }
}
