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

:root {
  --primary-color: #0d9488;
  /* Teal */
  --primary-light: #f0fdfa;
  --secondary-color: #f97316;
  /* Orange for active date */
  --secondary-light: #fff7ed;
  --accent-color: #8b5cf6;
  /* Purple for active time slot */
  --accent-light: #f5f3ff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --bg-body: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-body);
  color: var(--text-dark);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 0;
  margin: 0;
}

/* Wrapper to simulate mobile view on desktops */
.app-container {
  width: 100%;
  max-width: 480px;
  background-color: var(--card-bg);
  min-height: 100vh;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Header style */
.app-header {
  padding: 20px 24px 10px 24px;
  background-color: var(--card-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
}

.clinic-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.clinic-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.clinic-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* Stepper progress */
.stepper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin: 10px 0 5px 0;
}

.stepper::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 24px;
  right: 24px;
  height: 2px;
  background-color: #cbd5e1;
  z-index: 1;
}

.stepper-progress-bar {
  position: absolute;
  top: 14px;
  left: 24px;
  width: 0%;
  height: 2px;
  background-color: var(--primary-color);
  z-index: 2;
  transition: width 0.3s ease;
}

.step-item {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.step-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #f1f5f9;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
  transition: all 0.3s ease;
}

/* Completed state */
.step-item.completed .step-badge {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.step-item.completed .step-label {
  color: var(--primary-color);
  font-weight: 600;
}

/* Active state */
.step-item.active .step-badge {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  box-shadow: 0 0 0 4px var(--primary-light);
  border-radius: 8px;
  /* Square/rounded visual from image */
}

.step-item.active .step-label {
  color: var(--text-dark);
  font-weight: 700;
}

/* Main Content Area */
.app-content {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.step-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out forwards;
}

.step-content.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Form Styling - Step 1 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-color: #f8fafc;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
  background-color: #fff;
}

.phone-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.phone-prefix {
  position: absolute;
  left: 16px;
  font-weight: 600;
  color: var(--text-dark);
  font-size: 1rem;
  pointer-events: none;
}

.phone-input-wrapper input {
  padding-left: 62px;
}

/* Doctor card info - Step 2 */
.doctor-card {
  background: var(--bg-body);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border-color);
  position: relative;
}

.doctor-avatar-wrapper {
  position: relative;
}

.doctor-avatar {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  background-color: #fff;
  border: 1px solid var(--border-color);
}

.doctor-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doctor-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.doctor-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-dark);
}

.verified-icon {
  color: #10b981;
  display: inline-flex;
  align-items: center;
}

.doctor-spec {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.doctor-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.rating-stars {
  color: #f59e0b;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 2px;
}

.change-doctor-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.change-doctor-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Calendar Section */
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-month-selector {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-dark);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.calendar-nav-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-dark);
  transition: background-color 0.2s;
}

.calendar-nav-btn:hover {
  background-color: #f1f5f9;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  text-align: center;
}

.weekday-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-color);
  padding: 4px 0;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  user-select: none;
  border: none;
  background: none;
  color: var(--text-dark);
}

.calendar-day:hover:not(:disabled) {
  background-color: #f1f5f9;
}

.calendar-day:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}

.calendar-day.selected {
  background-color: var(--secondary-color) !important;
  color: white !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.day-dot {
  width: 4px;
  height: 4px;
  background-color: #10b981;
  border-radius: 50%;
  position: absolute;
  bottom: 4px;
}

.calendar-day.selected .day-dot {
  background-color: white;
}

/* Time Slot Section */
.time-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.time-slot {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background-color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.time-slot:hover:not(:disabled) {
  background-color: #f1f5f9;
}

.time-slot:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: line-through;
  background-color: #e2e8f0;
}

.time-slot.selected {
  background-color: var(--accent-color) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
  border-color: var(--accent-color);
}

/* Footer & Buttons */
.app-footer {
  padding: 16px 24px 24px 24px;
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  position: sticky;
  bottom: 0;
  z-index: 100;
}

.btn-primary {
  width: 100%;
  height: 52px;
  background-color: var(--primary-color);
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  background-color: #cbd5e1;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
  width: 100%;
  text-align: center;
  margin-top: 12px;
  display: inline-block;
}

/* Success Ticket - Step 3 */
.ticket-wrapper {
  animation: ticketPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes ticketPop {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.ticket {
  background-color: white;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.ticket-header {
  background-color: var(--primary-color);
  color: white;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.ticket-success-icon {
  width: 56px;
  height: 56px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  border: 2px solid white;
}

.ticket-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.ticket-subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
}

.ticket-divider {
  position: relative;
  height: 1px;
  border-bottom: 2px dashed var(--border-color);
  margin: 0;
  background-color: white;
}

.ticket-divider::before,
.ticket-divider::after {
  content: '';
  position: absolute;
  top: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  z-index: 10;
}

.ticket-divider::before {
  left: -9px;
  box-shadow: inset -3px 0 3px rgba(0, 0, 0, 0.02);
}

.ticket-divider::after {
  right: -9px;
  box-shadow: inset 3px 0 3px rgba(0, 0, 0, 0.02);
}

.ticket-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ticket-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.ticket-value {
  font-size: 0.95rem;
  color: var(--text-dark);
  font-weight: 600;
}

.ticket-value.highlight {
  color: var(--primary-color);
}

.ticket-barcode-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.barcode-svg {
  width: 180px;
  height: 48px;
}

.barcode-text {
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--text-muted);
  letter-spacing: 2px;
}

/* Bottom Sheet / Modal for changing doctor */
.bottom-sheet {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background-color: white;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  z-index: 200;
  padding: 24px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
  transition: bottom 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bottom-sheet.open {
  bottom: 0;
}

.bottom-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.bottom-sheet-overlay.open {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bottom-sheet-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.bottom-sheet-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.doctor-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
}

.doctor-option:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-color);
}

.doctor-option.selected {
  background-color: var(--primary-light);
  border-color: var(--primary-color);
  box-shadow: inset 0 0 0 1px var(--primary-color);
}

/* Spinner helper */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* Error message component */
.error-banner {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}