/* ============================================
   Booking Portal — Aligned Medical Massage
   Uses CSS variables from style.css
   ============================================ */

/* --- Step Transitions --- */
.booking-step {
  display: none;
  animation: fadeIn 0.3s ease;
}
.booking-step.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Login Form --- */
.login-form {
  max-width: 400px;
  margin: 60px auto;
  padding: 40px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.login-form h2 {
  text-align: center;
  margin-bottom: 8px;
}
.login-form .subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 28px;
}
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition);
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(42,122,110,0.12);
}
.form-group input::placeholder {
  color: #a0a8b0;
}
.login-form .new-patient-link {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-light);
}
.login-form .new-patient-link a {
  color: var(--primary);
  font-weight: 600;
}

/* Shake animation for login error */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.login-form.shake {
  animation: shake 0.4s ease;
}

/* --- Buttons (matches style.css patterns) --- */
.btn-booking {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  width: 100%;
}
.btn-booking.primary {
  background: var(--primary);
  color: var(--white);
}
.btn-booking.primary:hover {
  background: var(--primary-dark);
}
.btn-booking.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-booking.secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-booking.secondary:hover {
  background: var(--primary-light);
}

/* --- Welcome Bar --- */
.welcome-bar {
  margin-bottom: 24px;
}
.welcome-bar h2 {
  font-size: 1.5rem;
}

/* --- Therapist Pills --- */
.therapist-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.therapist-pills::-webkit-scrollbar {
  display: none;
}
.therapist-pill {
  flex-shrink: 0;
  padding: 8px 18px;
  border: 2px solid var(--border);
  border-radius: 50px;
  background: var(--white);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.therapist-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.therapist-pill.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* --- Date Navigation --- */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 16px;
}
.date-nav button {
  background: none;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}
.date-nav button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}
.date-nav button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.date-nav .week-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

/* --- Slot Grid --- */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.day-column {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.day-header {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  text-align: center;
}
.day-header .date-num {
  display: block;
  font-size: 1.1rem;
  color: var(--primary);
}
.day-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.no-slots {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
  text-align: center;
  padding: 12px 0;
}

/* --- Slot Buttons --- */
.slot-btn {
  display: block;
  width: 100%;
  padding: 10px 8px;
  border: 2px solid var(--primary);
  border-radius: 50px;
  background: transparent;
  color: var(--primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.slot-btn:hover {
  background: var(--primary-light);
}
.slot-btn.selected {
  background: var(--primary);
  color: var(--white);
}
.slot-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.slot-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --- Confirm Card --- */
.confirm-card {
  max-width: 480px;
  margin: 40px auto;
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 32px;
}
.confirm-card h3 {
  margin-bottom: 20px;
  font-size: 1.2rem;
}
.confirm-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin-bottom: 24px;
}
.confirm-card dt {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}
.confirm-card dd {
  color: var(--text-light);
  font-size: 0.9rem;
}
.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.back-link {
  display: block;
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}
.back-link:hover {
  color: var(--primary);
}

/* --- Success Screen --- */
.booking-success {
  text-align: center;
  padding: 48px 24px;
  max-width: 480px;
  margin: 0 auto;
}
.success-check {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  animation: scaleIn 0.4s ease;
}
@keyframes scaleIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.booking-success h2 {
  margin-bottom: 8px;
}
.booking-success .sms-note {
  color: var(--text-light);
  font-size: 0.9rem;
  margin: 16px 0 28px;
}
.success-details {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
  text-align: left;
}
.success-details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
}
.success-details dt { font-weight: 600; font-size: 0.85rem; }
.success-details dd { color: var(--text-light); font-size: 0.85rem; }
.success-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- Loading Spinner --- */
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Error / Warning Messages --- */
.error-message {
  background: #fef2f2;
  border-left: 4px solid #dc2626;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #991b1b;
  margin-bottom: 16px;
  display: none;
}
.error-message.visible {
  display: block;
}
.warning-message {
  background: #fef3c7;
  border-left: 4px solid #d97706;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #92400e;
  margin-bottom: 16px;
}

/* --- Booking page content area --- */
.booking-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 24px 100px;
  padding-top: calc(var(--header-height) + 24px);
  min-height: calc(100vh - 200px);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  /* Weekend mobile-audit polish: tighter side padding so content isn't over-inset on phones */
  .booking-content { padding-left: 16px; padding-right: 16px; }

  .login-form {
    margin: 24px 16px;
    padding: 28px 20px;
  }
  .slot-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .day-column {
    padding: 16px;
  }
  .day-slots {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .slot-btn {
    flex: 0 0 auto;
    width: auto;
    padding: 10px 18px;
  }
  .confirm-card {
    margin: 24px 0;
    padding: 24px 20px;
  }
  .booking-success {
    padding: 32px 16px;
  }
  .date-nav .week-label {
    font-size: 0.8rem;
  }
}

/* ============================================================
   B2 — Insurance Verification Badge (top-right pill + spinner)
   Brand color: the logo teal (#2a7a6e → #3a9e8f) from logo-full.svg.
   ============================================================ */
.insurance-badge {
  position: fixed;
  top: 88px;                /* clears the fixed site header */
  right: 20px;
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1rem 0.6rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #ffffff;
  background: linear-gradient(135deg, #2a7a6e 0%, #3a9e8f 100%);
  box-shadow: 0 8px 24px rgba(42, 122, 110, 0.32), 0 2px 6px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: saturate(1.2);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.5s ease, box-shadow 0.5s ease;
  pointer-events: none;     /* informational only */
}
.insurance-badge[hidden] { display: none; }
.insurance-badge.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.insurance-badge .ib-text { white-space: nowrap; }

/* Spinning ring (visible while verifying) */
.insurance-badge .ib-ring {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: ib-spin 0.8s linear infinite;
  flex: 0 0 auto;
}
@keyframes ib-spin { to { transform: rotate(360deg); } }

/* Checkmark (hidden until verified) */
.insurance-badge .ib-check {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: none;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}

/* --- Verified state: green gradient, ring → check, gentle pop --- */
.insurance-badge.verified {
  background: linear-gradient(135deg, #1e7a52 0%, #34b277 100%);
  box-shadow: 0 8px 24px rgba(30, 122, 82, 0.32), 0 2px 6px rgba(0, 0, 0, 0.12);
  animation: ib-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.insurance-badge.verified .ib-ring { display: none; }
.insurance-badge.verified .ib-check {
  display: block;
  animation: ib-draw 0.5s ease forwards;
}
@keyframes ib-draw { to { stroke-dashoffset: 0; } }
@keyframes ib-pop {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* --- Neutral state (flagged/unknown): calm, never alarming --- */
.insurance-badge.neutral {
  background: linear-gradient(135deg, #4a5a63 0%, #6b7c84 100%);
  box-shadow: 0 8px 24px rgba(74, 90, 99, 0.28), 0 2px 6px rgba(0, 0, 0, 0.12);
}
.insurance-badge.neutral .ib-ring,
.insurance-badge.neutral .ib-check { display: none; }

/* Fade-out helper (verified pill auto-dismisses) */
.insurance-badge.fade-out {
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .insurance-badge,
  .insurance-badge .ib-ring,
  .insurance-badge .ib-check,
  .insurance-badge.verified { animation: none; transition: opacity 0.3s ease; }
  .insurance-badge .ib-ring { border-top-color: rgba(255,255,255,0.9); }
}

@media (max-width: 560px) {
  .insurance-badge {
    top: 72px;
    right: 12px;
    font-size: 0.82rem;
    padding: 0.5rem 0.85rem 0.5rem 0.7rem;
  }
}
