/*
 * Booking System Widget — Premium Frontend CSS
 * Modern, Mobile-First, Glassmorphism
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Mapping dynamic theme variables to widget variables with fallbacks */
  --bs-primary:        var(--t-primary, #2563eb);
  --bs-primary-dark:   var(--t-dark, #1d4ed8);
  --bs-primary-light:  var(--t-light, #dbeafe);
  --bs-accent:         var(--t-accent, #3b82f6);
  --bs-bg:             var(--t-bg, #ffffff);
  --bs-text:           var(--t-text, #111827);
  --bs-radius:         var(--t-radius, 16px);
  --bs-btn-radius:     var(--t-btn-radius, 12px);

  --bs-success:        #10b981;
  --bs-danger:         #ef4444;
  --bs-warn:           #f59e0b;
  --bs-gray-50:        #f9fafb;
  --bs-gray-100:       #f3f4f6;
  --bs-gray-200:       #e5e7eb;
  --bs-gray-500:       #6b7280;
  --bs-gray-700:       #374151;
  --bs-gray-900:       #111827;
  
  --bs-white:          #ffffff;
  --bs-shadow-sm:      0 2px 4px rgba(0,0,0,.05);
  --bs-shadow:         0 10px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
  --bs-shadow-glow:    0 0 20px var(--bs-primary-light);
  --bs-font:           'Inter', -apple-system, sans-serif;
  --bs-transition:     all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --bs-glass:          blur(16px);
}

.bs-booking-widget *,
.bs-availability-widget *,
.bs-customer-portal * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Container ── */
.bs-booking-widget,
.bs-availability-widget,
.bs-customer-portal {
  font-family: var(--bs-font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--bs-text);
  background: var(--bs-bg);
  border-radius: var(--bs-radius);
  box-shadow: var(--bs-shadow);
  padding: 32px 24px;
  max-width: 640px;
  margin: 0 auto;
  border: 1px solid var(--bs-gray-100);
}

/* ── Step indicator ── */
.bs-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  overflow: hidden;
}

.bs-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  position: relative;
  transition: var(--bs-transition);
}

.bs-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--bs-gray-100);
  color: var(--bs-gray-500);
  transition: var(--bs-transition);
  z-index: 2;
}

.bs-step::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--bs-gray-100);
  z-index: 1;
}
.bs-step:last-child::after { display: none; }

.bs-step-label { font-weight: 600; color: var(--bs-gray-500); text-align: center; }

.bs-step-active .bs-step-num {
  background: var(--bs-primary);
  color: white;
  box-shadow: var(--bs-shadow-glow);
  transform: scale(1.1);
}
.bs-step-active .bs-step-label { color: var(--bs-primary); }

.bs-step-done .bs-step-num {
  background: var(--bs-primary-dark);
  color: white;
}
.bs-step-done::after { background: var(--bs-primary-light); }
.bs-step-done .bs-step-num::after { content: '✓'; }

/* ── Step body ── */
.bs-step-body { animation: bsFadeIn 300ms ease; }
.bs-step-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--bs-text);
  margin-bottom: 24px;
  text-align: center;
}

/* ── Service grid ── */
.bs-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.bs-service-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--bs-white);
  border: 2px solid var(--bs-gray-100);
  border-radius: var(--bs-btn-radius);
  cursor: pointer;
  transition: var(--bs-transition);
  box-shadow: var(--bs-shadow-sm);
  position: relative;
  overflow: hidden;
}

.bs-service-card:hover,
.bs-service-card:focus-visible {
  border-color: var(--bs-primary);
  transform: translateY(-2px);
  box-shadow: var(--bs-shadow);
  outline: none;
}

.bs-service-card.selected {
  border-color: var(--bs-primary);
  background: var(--bs-primary-light);
}

.bs-service-name { font-weight: 700; font-size: 16px; color: var(--bs-text); margin-bottom: 8px; }
.bs-service-meta { font-size: 14px; color: var(--bs-gray-500); display: flex; justify-content: space-between;}
.bs-service-price { font-weight: 700; color: var(--bs-primary); }

/* ── Calendar (Date selection fixed!) ── */
.bs-date-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.bs-date-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  border: 2px solid var(--bs-gray-100);
  border-radius: var(--bs-btn-radius);
  background: var(--bs-white);
  cursor: pointer;
  transition: var(--bs-transition);
  min-height: 80px;
}

.bs-date-btn:hover:not(.disabled) {
  border-color: var(--bs-primary-light);
  background: var(--bs-gray-50);
  transform: translateY(-2px);
}

.bs-date-btn.active {
  border-color: var(--bs-primary);
  background: var(--bs-primary);
  color: white;
  box-shadow: var(--bs-shadow-glow);
}

.bs-date-btn.active .bs-date-weekday { color: rgba(255,255,255,0.8); }
.bs-date-btn.active .bs-date-day { color: white; }

.bs-date-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: var(--bs-gray-50);
}

.bs-date-weekday { font-size: 12px; text-transform: uppercase; font-weight: 700; letter-spacing: 1px; color: var(--bs-gray-500); }
.bs-date-day     { font-size: 24px; font-weight: 800; line-height: 1; color: var(--bs-text); }

/* ── Time slots ── */
.bs-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.bs-slot-btn {
  padding: 12px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  border: 2px solid var(--bs-gray-100);
  border-radius: var(--bs-btn-radius);
  background: var(--bs-white);
  cursor: pointer;
  transition: var(--bs-transition);
  color: var(--bs-text);
}

.bs-slot-btn:hover:not(.active) {
  border-color: var(--bs-primary-light);
  color: var(--bs-primary);
  transform: translateY(-2px);
}

.bs-slot-btn.active {
  border-color: var(--bs-primary);
  background: var(--bs-primary);
  color: white;
  box-shadow: var(--bs-shadow-glow);
}

/* ── Forms ── */
.bs-details-form { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 480px) {
  .bs-details-form { grid-template-columns: 1fr 1fr; }
  .bs-field-full { grid-column: 1 / -1; }
}

.bs-field { display: flex; flex-direction: column; gap: 8px; }
.bs-field label { font-size: 14px; font-weight: 700; color: var(--bs-text); }
.bs-required { color: var(--bs-danger); }

.bs-field input, .bs-field textarea {
  padding: 14px 16px;
  font-size: 15px;
  font-family: var(--bs-font);
  border: 2px solid var(--bs-gray-100);
  border-radius: var(--bs-btn-radius);
  background: var(--bs-gray-50);
  color: var(--bs-text);
  transition: var(--bs-transition);
  width: 100%;
}

.bs-field input:focus, .bs-field textarea:focus {
  outline: none;
  border-color: var(--bs-primary);
  background: var(--bs-white);
  box-shadow: 0 0 0 4px var(--bs-primary-light);
}

/* ── Confirm Summary ── */
.bs-confirm-summary {
  background: var(--bs-gray-50);
  border-radius: var(--bs-radius);
  padding: 24px;
  margin-bottom: 32px;
  border: 1px solid var(--bs-gray-100);
}

.bs-confirm-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px dashed var(--bs-gray-200);
}
.bs-confirm-row:last-child { border-bottom: none; }
.bs-confirm-row dt { font-weight: 600; color: var(--bs-gray-500); }
.bs-confirm-row dd { font-weight: 700; color: var(--bs-text); }

/* ── Buttons ── */
.bs-nav {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 32px;
}

.bs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--bs-btn-radius);
  cursor: pointer;
  transition: var(--bs-transition);
  border: none;
}

.bs-btn-primary {
  background: linear-gradient(135deg, var(--bs-primary), var(--bs-primary-dark));
  color: white;
  box-shadow: 0 4px 12px var(--bs-primary-light);
  flex: 1;
}

.bs-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--bs-shadow-glow);
}

.bs-btn-secondary {
  background: var(--bs-gray-100);
  color: var(--bs-text);
}

.bs-btn-secondary:hover { background: var(--bs-gray-200); }
.bs-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Animations ── */
@keyframes bsFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes bsPopIn  { 0% { opacity: 0; transform: scale(0.8) translateY(20px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }

/* ── Success ── */
.bs-success { text-align: center; padding: 32px 0; animation: bsPopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.bs-success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bs-success);
  color: white;
  font-size: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}
.bs-success-ref { font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.bs-success-msg { color: var(--bs-gray-500); font-size: 16px; margin-bottom: 32px; }
