/**
 * Salon Management — Public CSS
 * Booking form, widgets, and all frontend components
 */

:root {
  --sm-primary:     #6C63FF;
  --sm-primary-light: #f0eeff;
  --sm-primary-dark:  #5a52e0;
  --sm-success:     #10B981;
  --sm-error:       #EF4444;
  --sm-text:        #1F2937;
  --sm-text-muted:  #6B7280;
  --sm-border:      #E5E7EB;
  --sm-bg:          #F9FAFB;
  --sm-card-bg:     #FFFFFF;
  --sm-radius:      10px;
  --sm-radius-sm:   6px;
  --sm-shadow:      0 2px 12px rgba(0,0,0,.08);
  --sm-shadow-lg:   0 4px 24px rgba(0,0,0,.12);
}

.sm-booking-form * { box-sizing: border-box; }
.sm-booking-form { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--sm-text); }

/* ── Progress steps ─────────────────────────────────────────────────── */
.sm-bf-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 16px;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.sm-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.sm-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sm-bg);
  border: 2px solid var(--sm-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--sm-text-muted);
  transition: all .2s;
}

.sm-step.active .sm-step-circle {
  background: var(--sm-primary);
  border-color: var(--sm-primary);
  color: #fff;
}

.sm-step.done .sm-step-circle {
  background: var(--sm-success);
  border-color: var(--sm-success);
  color: #fff;
}

.sm-step-label {
  font-size: 11px;
  color: var(--sm-text-muted);
  font-weight: 500;
}

.sm-step.active .sm-step-label { color: var(--sm-primary); font-weight: 600; }
.sm-step.done .sm-step-label   { color: var(--sm-success); }

.sm-step-line {
  width: 40px;
  height: 2px;
  background: var(--sm-border);
  flex-shrink: 0;
  margin-top: -16px;
  align-self: flex-start;
}
.sm-step-line.done { background: var(--sm-success); }

/* ── Body / Content area ────────────────────────────────────────────── */
.sm-bf-body { padding: 8px 24px 24px; min-height: 200px; }
.sm-bf-heading { font-size: 18px; font-weight: 600; margin: 0 0 20px; color: var(--sm-text); }

/* ── Selection grid (services & staff) ─────────────────────────────── */
.sm-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.sm-select-card {
  background: var(--sm-card-bg);
  border: 2px solid var(--sm-border);
  border-radius: var(--sm-radius);
  padding: 16px 12px;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
  font-family: inherit;
  width: 100%;
}

.sm-select-card:hover { border-color: var(--sm-primary); box-shadow: var(--sm-shadow); }
.sm-select-card.sm-selected { border-color: var(--sm-primary); background: var(--sm-primary-light); }

.sm-card-name  { font-size: 14px; font-weight: 600; color: var(--sm-text); margin-bottom: 5px; }
.sm-card-meta  { font-size: 12px; color: var(--sm-text-muted); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.sm-card-price { color: var(--sm-primary); font-weight: 600; }
.sm-card-desc  { font-size: 12px; color: var(--sm-text-muted); margin-top: 5px; }

/* Staff cards */
.sm-staff-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

.sm-staff-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sm-staff-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.sm-avatar-initials {
  background: var(--sm-primary);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}

.sm-avatar-any {
  background: #f3f4f6;
  color: #9ca3af;
}

/* ── Calendar ──────────────────────────────────────────────────────── */
.sm-calendar-wrap { margin-bottom: 20px; }
.sm-cal-loading   { text-align: center; padding: 40px; color: var(--sm-text-muted); font-size: 14px; }

.sm-cal { background: var(--sm-card-bg); border: 1px solid var(--sm-border); border-radius: var(--sm-radius); overflow: hidden; max-width: 380px; }

.sm-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--sm-primary);
  color: #fff;
}

.sm-cal-title { font-size: 15px; font-weight: 600; }

.sm-cal-nav {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.sm-cal-nav:hover { background: rgba(255,255,255,.35); }

.sm-cal-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--sm-bg);
  border-bottom: 1px solid var(--sm-border);
}
.sm-cal-days-header > div {
  text-align: center;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sm-text-muted);
  text-transform: uppercase;
}

.sm-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--sm-border);
}

.sm-cal-cell {
  background: var(--sm-card-bg);
  text-align: center;
  padding: 10px 4px;
  font-size: 13px;
  cursor: default;
}

.sm-cal-blank   { background: var(--sm-bg); }
.sm-cal-past    { color: #d1d5db; }
.sm-cal-unavail { color: #d1d5db; }

.sm-cal-avail {
  color: var(--sm-primary);
  font-weight: 600;
  cursor: pointer;
  background: var(--sm-primary-light);
}
.sm-cal-avail:hover { background: var(--sm-primary); color: #fff; }

.sm-cal-today   { text-decoration: underline; }
.sm-cal-selected { background: var(--sm-primary) !important; color: #fff !important; font-weight: 700; }
.sm-cal-no-avail { text-align: center; color: var(--sm-text-muted); font-size: 13px; padding: 10px 16px; }

/* Flatpickr overrides */
.sm-calendar-wrap .flatpickr-calendar { box-shadow: var(--sm-shadow); border-radius: var(--sm-radius); }
.sm-calendar-wrap .flatpickr-day.selected { background: var(--sm-primary); border-color: var(--sm-primary); }
.sm-calendar-wrap .flatpickr-day:hover { background: var(--sm-primary-light); }

/* ── Time slots ────────────────────────────────────────────────────── */
.sm-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.sm-slot-btn {
  padding: 10px 6px;
  border: 2px solid var(--sm-border);
  border-radius: var(--sm-radius-sm);
  background: var(--sm-card-bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--sm-text);
  transition: all .15s;
  font-family: inherit;
}
.sm-slot-btn:hover    { border-color: var(--sm-primary); color: var(--sm-primary); }
.sm-slot-btn.sm-selected { background: var(--sm-primary); border-color: var(--sm-primary); color: #fff; }

/* ── Details form ──────────────────────────────────────────────────── */
.sm-booking-summary {
  background: var(--sm-bg);
  border-radius: var(--sm-radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--sm-border);
}

.sm-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
  gap: 12px;
}
.sm-summary-row span { color: var(--sm-text-muted); }
.sm-summary-row strong { color: var(--sm-text); }

.sm-bf-form { margin-bottom: 20px; }

.sm-field { margin-bottom: 14px; }
.sm-field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--sm-text); }
.sm-field label .req { color: var(--sm-error); }

.sm-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media(max-width:500px) { .sm-field-row { grid-template-columns: 1fr; } }

.sm-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--sm-border);
  border-radius: var(--sm-radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--sm-text);
  background: var(--sm-card-bg);
  transition: border-color .15s;
}
.sm-input:focus { outline: none; border-color: var(--sm-primary); box-shadow: 0 0 0 3px rgba(108,99,255,.1); }
textarea.sm-input { resize: vertical; min-height: 80px; }

/* ── Navigation buttons ─────────────────────────────────────────────── */
.sm-bf-nav { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; border-top: 1px solid var(--sm-border); margin-top: 16px; }

.sm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--sm-radius-sm);
  border: 2px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
}

.sm-btn-primary {
  background: var(--sm-primary);
  border-color: var(--sm-primary);
  color: #fff;
}
.sm-btn-primary:hover { background: var(--sm-primary-dark); border-color: var(--sm-primary-dark); color: #fff; text-decoration: none; }

.sm-btn-back, .sm-btn-outline {
  background: transparent;
  border-color: var(--sm-border);
  color: var(--sm-text-muted);
}
.sm-btn-back:hover, .sm-btn-outline:hover { border-color: var(--sm-primary); color: var(--sm-primary); }

/* ── Success screen ─────────────────────────────────────────────────── */
.sm-bf-success { text-align: center; padding: 20px; }
.sm-bf-success-icon { font-size: 56px; margin-bottom: 12px; }
.sm-bf-success-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; color: var(--sm-text); }
.sm-bf-success-msg { color: var(--sm-text-muted); margin-bottom: 20px; }
.sm-success-summary { text-align: left; max-width: 340px; margin: 0 auto 20px; }

/* ── Loading spinner ────────────────────────────────────────────────── */
.sm-loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--sm-border);
  border-top-color: var(--sm-primary);
  border-radius: 50%;
  animation: sm-spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes sm-spin { to { transform: rotate(360deg); } }

/* ── Notices ─────────────────────────────────────────────────────────── */
.sm-notice { background: var(--sm-primary-light); color: var(--sm-primary); border-radius: var(--sm-radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.sm-bf-error { background: #fef2f2; color: var(--sm-error); border-radius: var(--sm-radius-sm); padding: 14px 16px; text-align: center; font-size: 14px; margin-bottom: 16px; }
.sm-bf-empty { text-align: center; padding: 30px 20px; color: var(--sm-text-muted); }
.sm-bf-empty-icon { font-size: 40px; margin-bottom: 10px; }

/* ── Services widget ─────────────────────────────────────────────────── */
.sm-svc-card { background: var(--sm-card-bg); border-radius: var(--sm-radius); overflow: hidden; box-shadow: var(--sm-shadow); }
.sm-svc-img img { width: 100%; height: 200px; object-fit: cover; display: block; }
.sm-svc-body { padding: 16px; }
.sm-svc-name { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.sm-svc-desc { font-size: 13px; color: var(--sm-text-muted); margin-bottom: 12px; line-height: 1.5; }
.sm-svc-footer { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sm-svc-price { font-size: 18px; font-weight: 700; color: var(--sm-primary); }
.sm-price-old { font-size: 13px; color: var(--sm-text-muted); text-decoration: line-through; margin-right: 4px; font-weight: 400; }
.sm-svc-duration { font-size: 13px; color: var(--sm-text-muted); }
.sm-svc-btn { width: 100%; }

/* ── Reviews ──────────────────────────────────────────────────────────── */
.sm-reviews-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.sm-review-item { background: var(--sm-card-bg); border-radius: var(--sm-radius); padding: 18px; box-shadow: var(--sm-shadow); }

/* ── Hours table ──────────────────────────────────────────────────────── */
.sm-hours-table tr:last-child td { padding-bottom: 0; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sm-bf-body { padding: 8px 16px 20px; }
  .sm-bf-progress { padding: 16px 8px 12px; gap: 0; }
  .sm-step-line { width: 20px; }
  .sm-step-label { font-size: 10px; }
  .sm-step-circle { width: 30px; height: 30px; font-size: 12px; }
  .sm-select-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .sm-slots-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
}
