/* ═══════════════════════════════════════════════════
   SMART BOOKING WIDGET — Stylesheet
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --sb-primary:   #2a9d8f;
  --sb-dark:      #264653;
  --sb-accent:    #e76f51;
  --sb-light:     #f0faf9;
  --sb-border:    #e2ebe9;
  --sb-text:      #264653;
  --sb-muted:     #8a9ba8;
  --sb-white:     #ffffff;
  --sb-radius:    14px;
  --sb-shadow:    0 24px 80px rgba(38,70,83,0.18);
  --sb-font:      'DM Sans', sans-serif;
  --sb-serif:     'DM Serif Display', serif;
}

/* ── TRIGGER BUTTON ──────────────────────────────── */
#sb-trigger {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg) translateX(50%);
  transform-origin: right center;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px 13px 16px;
  background: var(--sb-primary);
  color: #fff;
  border: none;
  border-radius: var(--sb-radius) var(--sb-radius) 0 0;
  font-family: var(--sb-font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  z-index: 99998;
  box-shadow: -4px 0 24px rgba(42,157,143,0.35);
  transition: all 0.3s cubic-bezier(.34,1.56,.64,1);
}

#sb-trigger:hover {
  background: var(--sb-dark);
  box-shadow: -6px 0 32px rgba(38,70,83,0.4);
  transform: translateY(-50%) rotate(-90deg) translateX(50%) scaleX(1.05);
}

#sb-trigger svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transform: rotate(90deg);
  stroke: white;
}

/* ── OVERLAY ─────────────────────────────────────── */
#sb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,25,30,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

#sb-overlay.sb-open {
  display: flex;
  animation: sbFadeIn 0.25s ease;
}

@keyframes sbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── MODAL ───────────────────────────────────────── */
#sb-modal {
  background: var(--sb-white);
  border-radius: 20px;
  box-shadow: var(--sb-shadow);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 36px;
  position: relative;
  animation: sbSlideUp 0.35s cubic-bezier(.34,1.56,.64,1);
  font-family: var(--sb-font);
  color: var(--sb-text);
}

@keyframes sbSlideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── CLOSE BUTTON ────────────────────────────────── */
#sb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--sb-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#sb-close:hover {
  background: #f0f4f6;
  color: var(--sb-dark);
}

/* ── STEP INDICATOR ──────────────────────────────── */
#sb-steps {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--sb-border);
}

.sb-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sb-step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sb-border);
  color: var(--sb-muted);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.sb-step.active .sb-step-num {
  background: var(--sb-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(42,157,143,0.4);
}

.sb-step.done .sb-step-num {
  background: var(--sb-dark);
  color: white;
}

.sb-step-label {
  font-weight: 500;
  font-size: 14px;
  color: var(--sb-muted);
  transition: color 0.3s;
}

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

.sb-step-line {
  flex: 1;
  height: 2px;
  background: var(--sb-border);
  margin: 0 16px;
  border-radius: 2px;
}

/* ── STEP PANELS ─────────────────────────────────── */
#sb-step-1 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

/* ── CALENDAR ────────────────────────────────────── */
#sb-left h2, #sb-right h2, #sb-verify-wrap h2 {
  font-family: var(--sb-serif);
  font-size: 20px;
  margin: 0 0 16px;
  color: var(--sb-dark);
}

#sb-calendar {
  border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius);
  padding: 20px;
  background: #fafcfc;
}

#sb-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

#sb-cal-header button {
  background: none;
  border: 1px solid var(--sb-border);
  color: var(--sb-dark);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#sb-cal-header button:hover {
  background: var(--sb-primary);
  border-color: var(--sb-primary);
  color: white;
}

#sb-month-label {
  font-weight: 700;
  font-size: 16px;
  color: var(--sb-dark);
}

#sb-cal-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 8px;
}

#sb-cal-days-header span {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--sb-muted);
  padding: 4px 0;
}

#sb-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.sb-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  font-weight: 500;
  color: var(--sb-text);
}

.sb-cal-day:hover:not(.sb-disabled):not(.sb-empty) {
  background: var(--sb-light);
  border-color: var(--sb-primary);
  color: var(--sb-primary);
}

.sb-cal-day.sb-today {
  /* Base today style — overridden by sb-today-no-book below */
  font-weight: 700;
}

.sb-cal-day.sb-selected {
  background: var(--sb-dark);
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(38,70,83,0.3);
}

.sb-cal-day.sb-disabled {
  color: #d0d9dd;
  cursor: default;
  pointer-events: none;
}

.sb-cal-day.sb-empty {
  cursor: default;
}

/* ── TIME SLOTS ──────────────────────────────────── */
#sb-right {
  display: flex;
  flex-direction: column;
}

#sb-selected-date-label {
  font-size: 13px;
  color: var(--sb-muted);
  margin: 0 0 14px;
  font-style: italic;
}

#sb-slots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
}

.sb-slot {
  padding: 12px 10px;
  border: 1.5px solid var(--sb-border);
  border-radius: 10px;
  text-align: center;
  font-family: var(--sb-font);
  font-size: 14px;
  font-weight: 500;
  color: var(--sb-dark);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--sb-white);
}

.sb-slot:hover {
  border-color: var(--sb-primary);
  color: var(--sb-primary);
  background: var(--sb-light);
}

.sb-slot.sb-slot-selected {
  background: var(--sb-primary);
  border-color: var(--sb-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(42,157,143,0.35);
}

/* Booked slot — visible but not clickable, no strikethrough */
.sb-slot.sb-slot-booked {
  background: #f5f5f5;
  border-color: #e0e0e0;
  color: #bbb;
  cursor: not-allowed;
  opacity: 0.75;
}
.sb-slot.sb-slot-booked:hover {
  border-color: #e0e0e0;
  color: #bbb;
  background: #f5f5f5;
}

/* Today-blocked slot — grayed, no strikethrough, not clickable, with tooltip */
.sb-slot.sb-slot-today-blocked {
  background: #fafafa;
  border-color: #e8e8e8;
  color: #ccc;
  cursor: not-allowed;
  position: relative;
}
.sb-slot.sb-slot-today-blocked:hover {
  border-color: #e8e8e8;
  color: #ccc;
  background: #fafafa;
}
.sb-slot.sb-slot-today-blocked:hover::after {
  content: "Same day booking unavailable";
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a2e35;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
}

/* Booked slot — visible, grayed, not clickable, with tooltip */
.sb-slot.sb-slot-booked {
  background: #f5f5f5;
  border-color: #e0e0e0;
  color: #bbb;
  cursor: not-allowed;
  opacity: 0.75;
  position: relative;
}
.sb-slot.sb-slot-booked:hover {
  border-color: #e0e0e0;
  color: #bbb;
  background: #f5f5f5;
}
.sb-slot.sb-slot-booked:hover::after {
  content: "Already booked";
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a2e35;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
}

/* Today on calendar — grayed, dashed border, not bookable */
.sb-cal-day.sb-today-no-book {
  color: #aaa !important;
  cursor: not-allowed !important;
  background: #f9f9f9 !important;
  border: 1.5px dashed #ccc !important;
  pointer-events: auto !important; /* hover + tooltip ke liye zaroori */
}

.sb-hint {
  font-size: 12px;
  color: var(--sb-muted);
  margin: 10px 0 0;
  font-style: italic;
}

/* ── NEXT BUTTON ─────────────────────────────────── */
#sb-next-btn {
  margin-top: 20px;
  padding: 14px 28px;
  background: var(--sb-primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: var(--sb-font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  width: 100%;
  letter-spacing: 0.3px;
}

#sb-next-btn:disabled {
  background: var(--sb-border);
  color: var(--sb-muted);
  cursor: not-allowed;
}

#sb-next-btn:not(:disabled):hover {
  background: var(--sb-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(38,70,83,0.25);
}

/* ── STEP 2 / VERIFY ─────────────────────────────── */
#sb-step-2 { animation: sbFadeIn 0.3s ease; }

#sb-verify-wrap {
  max-width: 480px;
  margin: 0 auto;
}

#sb-booking-summary {
  background: var(--sb-light);
  border: 1px solid var(--sb-border);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  color: var(--sb-dark);
  margin-bottom: 24px;
  line-height: 1.6;
}

#sb-user-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--sb-dark);
  margin: 16px 0 6px;
}

#sb-user-form input[type="text"],
#sb-user-form input[type="email"],
#sb-user-form input[type="tel"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--sb-border);
  border-radius: 10px;
  font-family: var(--sb-font);
  font-size: 14px;
  color: var(--sb-dark);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

#sb-user-form input:focus {
  border-color: var(--sb-primary);
  box-shadow: 0 0 0 3px rgba(42,157,143,0.12);
}

/* ── OTP TABS ────────────────────────────────────── */
#sb-otp-tabs {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.sb-tab-btn {
  flex: 1;
  padding: 10px;
  border: 1.5px solid var(--sb-border);
  border-radius: 8px;
  font-family: var(--sb-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: white;
  color: var(--sb-muted);
  transition: all 0.2s;
}

.sb-tab-btn.active {
  border-color: var(--sb-primary);
  background: var(--sb-light);
  color: var(--sb-primary);
}

/* ── SEND OTP BUTTON ─────────────────────────────── */
#sb-send-otp-btn {
  margin-top: 16px;
  padding: 13px 20px;
  background: var(--sb-accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: var(--sb-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  width: 100%;
}

#sb-send-otp-btn:hover { background: #d95f3b; transform: translateY(-1px); }
#sb-send-otp-btn:disabled { background: var(--sb-border); color: var(--sb-muted); cursor: default; transform: none; }

/* ── OTP DIGIT INPUTS ────────────────────────────── */
#sb-otp-box { margin-top: 20px; animation: sbFadeIn 0.3s ease; }
#sb-otp-box label { font-size: 13px; font-weight: 600; color: var(--sb-dark); }

#sb-otp-inputs {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: center;
}

.sb-otp-digit {
  width: 46px;
  height: 54px;
  text-align: center;
  border: 1.5px solid var(--sb-border);
  border-radius: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--sb-dark);
  font-family: var(--sb-font);
  outline: none;
  transition: all 0.2s;
}

.sb-otp-digit:focus {
  border-color: var(--sb-primary);
  box-shadow: 0 0 0 3px rgba(42,157,143,0.15);
  transform: scale(1.05);
}

#sb-resend-wrap {
  font-size: 12px;
  color: var(--sb-muted);
  text-align: center;
  margin: 12px 0 16px;
}

.sb-link-btn {
  background: none;
  border: none;
  color: var(--sb-primary);
  cursor: pointer;
  font-family: var(--sb-font);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
}

#sb-verify-btn {
  width: 100%;
  padding: 14px;
  background: var(--sb-dark);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: var(--sb-font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

#sb-verify-btn:hover {
  background: var(--sb-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(42,157,143,0.3);
}

#sb-verify-msg {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  min-height: 18px;
}

#sb-verify-msg.error { color: #e63946; }
#sb-verify-msg.success { color: var(--sb-primary); }

/* ── SUCCESS SCREEN ──────────────────────────────── */
#sb-success {
  text-align: center;
  padding: 20px 0;
  animation: sbFadeIn 0.4s ease;
}

#sb-success-inner { max-width: 380px; margin: 0 auto; }

#sb-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
}

#sb-checkmark svg {
  width: 80px;
  height: 80px;
}

#sb-checkmark circle {
  stroke: var(--sb-primary);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: sbCircle 0.6s ease-out forwards;
}

#sb-checkmark path {
  stroke: var(--sb-primary);
  stroke-width: 3;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: sbCheck 0.4s 0.5s ease-out forwards;
}

@keyframes sbCircle {
  to { stroke-dashoffset: 0; }
}

@keyframes sbCheck {
  to { stroke-dashoffset: 0; }
}

#sb-success h2 {
  font-family: var(--sb-serif);
  font-size: 26px;
  color: var(--sb-dark);
  margin: 0 0 8px;
}

#sb-success-detail {
  color: var(--sb-muted);
  font-size: 15px;
  margin: 0 0 28px;
  line-height: 1.6;
}

#sb-done-btn {
  padding: 13px 40px;
  background: var(--sb-primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: var(--sb-font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

#sb-done-btn:hover {
  background: var(--sb-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(38,70,83,0.25);
}

/* ── LOADING STATE ───────────────────────────────── */
.sb-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.sb-loading::after {
  content: '';
  position: absolute;
  inset: 50% 50% auto auto;
  transform: translate(50%, -50%);
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: sbSpin 0.7s linear infinite;
}

@keyframes sbSpin { to { transform: translate(50%,-50%) rotate(360deg); } }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 640px) {
  #sb-modal {
    padding: 24px 18px;
    max-height: 95vh;
  }

  #sb-step-1 {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  #sb-trigger {
    padding: 10px 16px 10px 12px;
    font-size: 13px;
  }

  #sb-slots-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sb-otp-digit {
    width: 40px;
    height: 48px;
    font-size: 20px;
  }
}

/* ─── LOADING SPINNER ──────────────────────────────────────────── */
.sb-spinner {
  margin: 20px auto;
  width: 40px;
  height: 40px;
  border: 4px solid #f0f0f0;
  border-top-color: #2a9d8f;
  border-radius: 50%;
  animation: sb-spin 0.8s linear infinite;
}

@keyframes sb-spin {
  to { transform: rotate(360deg); }
}

/* ─── LOADING STATE ────────────────────────────────────────────── */
.sb-btn-primary.sb-loading,
button.sb-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.sb-btn-primary.sb-loading::after,
button.sb-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: sb-spin 0.6s linear infinite;
}


/* ─── TODAY CELL TOOLTIP ────────────────────────────────────────── */
/* Calendar aur grid pe overflow visible karo taaki tooltip clip na ho */
#sb-calendar,
#sb-cal-grid {
  overflow: visible;
}

.sb-cal-day[data-sb-tooltip] {
  position: relative;
}

/* Tooltip box — ऊपर dikhega */
.sb-cal-day[data-sb-tooltip]::after {
  content: attr(data-sb-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 9999;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  line-height: 1.4;
}

/* Toothpick arrow — neeche ka tip */
.sb-cal-day[data-sb-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #222;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 9999;
}

.sb-cal-day[data-sb-tooltip]:hover::after,
.sb-cal-day[data-sb-tooltip]:hover::before {
  opacity: 1;
}