/* Appointment Wizard Styles */

/* Page Layout */
.appointment-page {
  margin-top: 80px;
  min-height: calc(100vh - 80px - 60px);
  background: var(--light-bg);
  padding: 2rem 1rem 4rem;
}

/* Page Hero Banner */
.appointment-hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--white);
  margin-top: 80px;
}

.appointment-hero h1 {
  color: var(--white);
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.appointment-hero p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  margin: 0;
}

/* Wizard Container */
.wizard-container,
.appt-wizard-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem clamp(0.75rem, 4vw, 2rem) 3rem;
  width: 100%;
  box-sizing: border-box;
}

/* Step Progress Bar */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 3rem;
  gap: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
  max-width: 200px;
}

.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 22px;
  left: 60%;
  right: -40%;
  height: 3px;
  background: var(--border-color);
  z-index: 0;
  transition: background 0.4s ease;
}

.progress-step.completed:not(:last-child)::after {
  background: var(--primary-color);
}

.step-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-muted);
  transition: all 0.4s ease;
  position: relative;
  z-index: 1;
}

.progress-step.active .step-circle {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.4);
  transform: scale(1.1);
}

.progress-step.completed .step-circle {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--white);
}

.step-label {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.progress-step.active .step-label {
  color: var(--primary-color);
  font-weight: 700;
}

.progress-step.completed .step-label {
  color: var(--primary-color);
}

/* Wizard Card */
.wizard-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(var(--primary-dark-rgb), 0.1);
  overflow: hidden;
  border: 1px solid rgba(var(--primary-rgb), 0.08);
}

.wizard-card-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.wizard-card-header .step-icon {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--white);
  flex-shrink: 0;
}

.wizard-card-header h2 {
  color: var(--white);
  font-size: 1.5rem;
  margin: 0 0 0.25rem 0;
}

.wizard-card-header p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  margin: 0;
}

.wizard-card-body {
  padding: 2.5rem 2rem;
}

/* Wizard Steps Panels */
.wizard-step {
  display: none;
  animation: fadeSlideIn 0.35s ease-out;
}

.wizard-step.active {
  display: block;
}

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

/* Form Styles */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-row.full-width {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
}

.form-group label .required {
  color: #e53e3e;
  margin-left: 3px;
}

.form-control-appt {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text-dark);
  background: var(--white);
  transition: all 0.25s ease;
  outline: none;
  font-family: inherit;
  appearance: auto;
}

.form-control-appt:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.form-control-appt.error {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.field-error {
  font-size: 0.8rem;
  color: #e53e3e;
  display: none;
  margin-top: 2px;
}

.field-error.visible {
  display: block;
}

textarea.form-control-appt {
  resize: vertical;
  min-height: 100px;
}

/* Date & Time Picker Grid */
.datetime-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Time Slots */
.time-slot-section {
  margin-bottom: 1.5rem;
}

.time-slot-section label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

.time-slot-section label .required {
  color: #e53e3e;
  margin-left: 3px;
}

.time-slots-hint,
.time-slots-loading {
  font-size: 0.9rem;
  color: #64748b;
  margin: 0.25rem 0 0.5rem;
}

.time-slots-blocked {
  color: #b45309;
  font-weight: 600;
}

.time-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.6rem;
}

.time-slot-btn {
  padding: 0.6rem 0.5rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--white);
  color: var(--text-dark);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.time-slot-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--accent-color);
}

.time-slot-btn.selected {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

/* Preview / Confirmation Step */
.preview-card {
  background: var(--light-bg);
  border-radius: 14px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.preview-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  gap: 1rem;
}

.preview-row:last-child {
  border-bottom: none;
}

.preview-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 140px;
}

.preview-value {
  font-size: 0.9rem;
  color: var(--text-dark);
  font-weight: 600;
  text-align: right;
}

.preview-status-badge {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  border-radius: 50px;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Confirmation Screen */
.confirmation-screen {
  text-align: center;
  padding: 3rem 2rem;
}

.confirmation-icon {
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
  color: var(--white);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.confirmation-screen h2 {
  color: var(--primary-color);
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.confirmation-screen p {
  color: var(--text-light);
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.confirmation-ref {
  display: inline-block;
  background: var(--accent-color);
  border: 1px solid var(--primary-color);
  color: var(--primary-dark);
  border-radius: 8px;
  padding: 0.5rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  margin: 1rem 0 2rem;
}

/* Navigation Buttons */
.wizard-footer {
  padding: 1.25rem clamp(1rem, 3vw, 2rem);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(180deg, #fafdfb 0%, #fff 100%);
  flex-wrap: wrap;
}

.wizard-footer-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}

.btn-appt-sm {
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
}

.btn-appt {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 2rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
}

.btn-appt-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: var(--white);
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
}

.btn-appt-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.45);
  color: var(--white);
}

.btn-appt-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-appt-outline {
  background: var(--white);
  color: var(--text-dark);
  border: 2px solid var(--border-color);
}

.btn-appt-outline:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-appt-home {
  background: var(--white);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-appt-home:hover {
  background: var(--primary-color);
  color: var(--white);
}

/* Loading Spinner inside button */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn-spinner.visible {
  display: inline-block;
}

/* Info note */
.appt-note {
  background: #e8f5e9;
  border-left: 4px solid var(--primary-color);
  border-radius: 0 8px 8px 0;
  padding: 0.9rem 1.2rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: var(--primary-dark);
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.appt-note i {
  margin-top: 1px;
  flex-shrink: 0;
}

/* ── Doctor Selection Grid ────────────────────────────────────────────────── */
.doctor-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.doctor-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

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

.doctor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.1rem;
  margin-bottom: 0.75rem;
}

.doctor-card {
  background: var(--white);
  border: 2px solid var(--border-color);
  border-radius: 14px;
  padding: 1.4rem 1.2rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.7rem;
  position: relative;
}

.doctor-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 18px rgba(var(--primary-rgb), 0.15);
  transform: translateY(-3px);
}

.doctor-card.selected {
  border-color: var(--primary-color);
  background: #f0fdf0;
  box-shadow: 0 4px 18px rgba(var(--primary-rgb), 0.22);
}

.doctor-card-check {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 22px;
  height: 22px;
  background: var(--primary-color);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 0.7rem;
}

.doctor-card.selected .doctor-card-check {
  display: flex;
}

.doctor-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  color: var(--white);
  flex-shrink: 0;
  overflow: hidden;
}

.doctor-avatar--photo {
  background: #e8ecef;
  padding: 0;
}

.doctor-avatar--photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.doctor-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
}

.doctor-card-speciality {
  display: inline-block;
  background: #e8f5e9;
  color: var(--primary-dark);
  border: 1px solid #c8e6c9;
  border-radius: 50px;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.doctor-card-degrees {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 0.15rem;
}

.doctor-card-role {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.doctor-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.doctor-empty i {
  font-size: 3rem;
  color: var(--border-color);
  display: block;
  margin-bottom: 0.75rem;
}

.doctor-empty p {
  font-size: 0.95rem;
  margin: 0;
}

/* ── Progress bar: 4 steps ────────────────────────────────────────────────── */
.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 22px;
  left: 60%;
  right: -40%;
  height: 3px;
  background: var(--border-color);
  z-index: 0;
  transition: background 0.4s ease;
}

/* WhatsApp OTP step */
.otp-panel {
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
  padding: 1rem 0 0.5rem;
}

.otp-wa-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: linear-gradient(145deg, #25d366, #128c7e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  color: #fff;
  box-shadow: 0 10px 28px rgba(37, 211, 102, 0.35);
}

.otp-title {
  font-size: 1.35rem;
  color: var(--text-dark);
  margin: 0 0 0.5rem;
}

.otp-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.otp-input-wrap {
  margin-bottom: 0.75rem;
}

.otp-input {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  display: block;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.45em;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 14px;
  font-family: ui-monospace, monospace;
  color: var(--primary-dark);
  background: #f8faf9;
}

.otp-input:focus {
  border-color: #25d366;
  box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.15);
  outline: none;
}

.otp-timer-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.75rem 0 1rem;
}

/* Appointment ticket card (export) */
.confirmation-card-wrap {
  max-width: 520px;
  margin: 0 auto;
}

.appt-card-export-wrap {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
  padding: 0 clamp(0.5rem, 3vw, 1rem);
}

.appt-ticket {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary-color) 42%, var(--section-tint, var(--accent-color)) 100%);
  border-radius: 18px;
  padding: 3px;
  box-shadow: 0 16px 40px rgba(var(--primary-dark-rgb), 0.25);
  text-align: left;
}

.appt-ticket-header,
.appt-ticket-body,
.appt-ticket-footer {
  background: #fff;
}

.appt-ticket-header {
  border-radius: 15px 15px 0 0;
  padding: 1.1rem 1.25rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.appt-ticket-brand {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.appt-ticket-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e8f5e9;
  color: var(--primary-dark);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
}

.appt-ticket-ref {
  background: var(--primary-color);
  color: #fff;
  font-weight: 800;
  font-size: 1.35rem;
  text-align: center;
  padding: 0.65rem;
  letter-spacing: 0.05em;
}

.appt-ticket-body {
  padding: 1rem 1.25rem 1.1rem;
}

.appt-ticket-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
  font-size: 0.88rem;
}

.appt-ticket-row span {
  color: #64748b;
  flex-shrink: 0;
}

.appt-ticket-row strong {
  color: var(--text-dark);
  text-align: right;
  font-weight: 700;
}

.appt-ticket-row--status strong {
  color: #b45309;
}

.appt-ticket-footer {
  border-radius: 0 0 15px 15px;
  padding: 0.65rem 1.25rem;
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
}

.confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.5rem;
}

/* Desktop polish */
@media (min-width: 992px) {
  .appointment-hero {
    padding: 3.5rem 2rem;
  }

  .appointment-hero h1 {
    font-size: 2.75rem;
  }

  .wizard-card-body {
    padding: 2.75rem 2.5rem;
  }

  .doctor-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .time-slots-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* Responsive */
@media (max-width: 768px) {
  .doctor-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .appointment-hero h1 {
    font-size: 1.8rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .datetime-grid {
    grid-template-columns: 1fr;
  }

  .wizard-card-body {
    padding: 1.5rem 1rem;
  }

  .wizard-footer {
    padding: 1rem;
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .wizard-footer-actions {
    width: 100%;
    margin-left: 0;
    flex-direction: column;
  }

  .wizard-footer #btnBack {
    width: 100%;
    justify-content: center;
  }

  .btn-appt {
    width: 100%;
    justify-content: center;
  }

  .appointment-hero {
    padding: 2rem 1rem;
  }

  .otp-input {
    max-width: 100%;
    letter-spacing: 0.35em;
    font-size: 1.5rem;
  }

  .confirmation-actions .btn-appt,
  .confirmation-actions a.btn-appt {
    width: 100%;
  }

  .progress-step:not(:last-child)::after {
    left: 55%;
    right: -45%;
  }

  .step-label {
    font-size: 0.7rem;
  }

  .preview-label {
    min-width: 110px;
  }

  .wizard-progress {
    gap: 0;
  }

  .time-slots-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .confirmation-screen {
    padding: 0.5rem .5rem;
  }
}

@media (max-width: 400px) {
  .doctor-grid {
    grid-template-columns: 1fr;
  }

  .time-slots-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .step-label {
    display: none;
  }
}
