/* ============================================================
   Flavour Booking — Frontend Widget
   Colors (--fb-primary, --fb-primary-dark, --fb-accent) are
   injected via inline style from plugin settings.
   ============================================================ */

.fb-booking-widget {
  /* Fallback colors — overridden by inline style from admin settings */
  --fb-primary: #4A3728;
  --fb-primary-dark: #362619;
  --fb-accent: #D4B896;
  /* Derived from primary */
  --fb-text: color-mix(in srgb, var(--fb-primary) 90%, black);
  --fb-text-muted: color-mix(in srgb, var(--fb-primary) 50%, #888);
  --fb-bg: color-mix(in srgb, var(--fb-accent) 8%, white);
  --fb-bg-alt: color-mix(in srgb, var(--fb-accent) 18%, white);
  --fb-border: color-mix(in srgb, var(--fb-accent) 35%, #ccc);
  --fb-radius: 0.75rem;
  --fb-font: system-ui, -apple-system, sans-serif;

  font-family: var(--fb-font);
  color: var(--fb-text);
  max-width: 640px;
  margin: 0 auto;
}

/* ── Steps indicator ── */
.fb-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2rem;
  padding: 0 1rem;
}
.fb-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0;
}
.fb-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--fb-bg-alt);
  color: var(--fb-text-muted);
  flex-shrink: 0;
}
.fb-step.active .fb-step-num {
  background: var(--fb-primary);
  color: #fff;
}
.fb-step.done .fb-step-num {
  background: var(--fb-accent);
  color: var(--fb-primary-dark);
}
.fb-step-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fb-text-muted);
}
.fb-step.active .fb-step-label { color: var(--fb-text); font-weight: 600; }
.fb-step.done .fb-step-label { color: var(--fb-text); }
.fb-step-line {
  width: 32px;
  height: 2px;
  background: var(--fb-border);
  margin: 0 0.5rem;
  flex-shrink: 0;
}

/* ── Section ── */
.fb-section {
  background: var(--fb-bg);
  border: 1px solid var(--fb-border);
  border-radius: var(--fb-radius);
  padding: 2rem;
}
.fb-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.fb-subtitle {
  color: var(--fb-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ── Loading ── */
.fb-loading {
  display: flex;
  justify-content: center;
  padding: 3rem;
}
.fb-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--fb-border);
  border-top-color: var(--fb-primary);
  border-radius: 50%;
  animation: fb-spin 0.6s linear infinite;
}
@keyframes fb-spin { to { transform: rotate(360deg); } }

/* ── Error ── */
.fb-error {
  background: #fdf2f2;
  border: 1px solid #f5c6cb;
  color: #721c24;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ── Service cards ── */
.fb-svc-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.fb-svc-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: var(--fb-bg-alt);
  border: 2px solid transparent;
  border-radius: var(--fb-radius);
  cursor: pointer;
  transition: all 0.2s;
}
.fb-svc-card:hover {
  border-color: var(--fb-accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.fb-svc-card.selected {
  border-color: var(--fb-primary);
  background: #fff;
}
.fb-svc-card strong {
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.fb-svc-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--fb-text-muted);
}
.fb-svc-price {
  font-weight: 700;
  color: var(--fb-primary);
  font-size: 1rem;
}
.fb-svc-student {
  font-size: 0.8rem;
  color: var(--fb-text-muted);
}
.fb-badge-online {
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--fb-accent);
  color: var(--fb-primary-dark);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

/* ── Calendar ── */
.fb-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.fb-cal-title {
  font-size: 1.05rem;
  font-weight: 600;
}
.fb-cal-nav {
  background: none;
  border: 1px solid var(--fb-border);
  border-radius: 0.4rem;
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fb-text);
  transition: all 0.15s;
}
.fb-cal-nav:hover { background: var(--fb-bg-alt); }
.fb-cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fb-text-muted);
  margin-bottom: 0.5rem;
}
.fb-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.fb-cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border-radius: 0.4rem;
  font-weight: 500;
}
.fb-cal-cell.empty { visibility: hidden; }
.fb-cal-cell.disabled { color: var(--fb-border); cursor: default; }
.fb-cal-cell.available {
  background: var(--fb-bg-alt);
  cursor: pointer;
  font-weight: 600;
  color: var(--fb-primary);
  transition: all 0.15s;
}
.fb-cal-cell.available:hover {
  background: var(--fb-accent);
  color: var(--fb-primary-dark);
}
.fb-cal-cell.selected {
  background: var(--fb-primary);
  color: #fff;
  font-weight: 700;
}

/* ── Time slots ── */
.fb-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
}
.fb-slot {
  padding: 0.7rem;
  background: var(--fb-bg-alt);
  border: 2px solid transparent;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--fb-font);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  color: var(--fb-primary);
}
.fb-slot:hover {
  border-color: var(--fb-accent);
  background: #fff;
}
.fb-slot.selected {
  background: var(--fb-primary);
  color: #fff;
  border-color: var(--fb-primary);
}
.fb-empty {
  text-align: center;
  color: var(--fb-text-muted);
  padding: 2rem;
}

/* ── Form ── */
.fb-summary {
  display: flex;
  justify-content: space-between;
  background: var(--fb-bg-alt);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.fb-summary span:first-child { font-weight: 600; }
.fb-summary span:last-child { color: var(--fb-text-muted); }

.fb-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.fb-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.fb-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fb-text);
}
.fb-field input,
.fb-field textarea {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--fb-border);
  border-radius: 0.5rem;
  font-family: var(--fb-font);
  font-size: 0.95rem;
  background: #fff;
  color: var(--fb-text);
  transition: border-color 0.15s;
}
.fb-field input:focus,
.fb-field textarea:focus {
  outline: none;
  border-color: var(--fb-primary);
  box-shadow: 0 0 0 3px rgba(74, 55, 40, 0.1);
}
.fb-field textarea { resize: vertical; }

.fb-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.fb-check input[type=checkbox] {
  width: 18px;
  height: 18px;
  accent-color: var(--fb-primary);
}
.fb-check label {
  font-weight: 400;
  font-size: 0.9rem;
}

.fb-price-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--fb-bg-alt);
  border-radius: 0.5rem;
  font-size: 1rem;
}
.fb-price-display strong {
  font-size: 1.25rem;
  color: var(--fb-primary);
}

/* ── Buttons ── */
.fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--fb-font);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.fb-btn-primary {
  background: var(--fb-primary);
  color: #fff;
  width: 100%;
}
.fb-btn-primary:hover { background: var(--fb-primary-dark); }
.fb-btn-secondary {
  background: transparent;
  color: var(--fb-primary);
  border-color: var(--fb-primary);
}
.fb-btn-secondary:hover { background: var(--fb-primary); color: #fff; }

/* ── Done screen ── */
.fb-done { text-align: center; }
.fb-done-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #d4edda;
  color: #155724;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}
.fb-done-info {
  background: var(--fb-bg-alt);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin: 1rem 0;
}
.fb-done-info p { margin: 0.25rem 0; }
.fb-done-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fb-primary);
  margin-top: 0.5rem !important;
}
.fb-done-note {
  color: var(--fb-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .fb-section { padding: 1.25rem; }
  .fb-steps { gap: 0; }
  .fb-step-label { display: none; }
  .fb-step-line { width: 20px; }
  .fb-svc-card { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .fb-svc-meta { flex-wrap: wrap; gap: 0.5rem; }
  .fb-slots-grid { grid-template-columns: repeat(3, 1fr); }
  .fb-summary { flex-direction: column; }
}
