/* ===========================================
   Multi-Tenant Booking Styles
   Supports dynamic branding via CSS variables
   =========================================== */

:root {
  --brand-primary: #1e3a5f;
  --brand-secondary: #2563eb;
  --text-primary: #1f2933;
  --text-secondary: #52606d;
  --bg-page: #f5f7fb;
  --bg-card: #ffffff;
  --bg-selected: #eaf2ff;
  --border-color: #d9e2ec;
  --border-selected: var(--brand-secondary);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-page);
  margin: 0;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ===========================================
   Layout
   =========================================== */

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 20px 100px;
}

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

.brand {
  display: flex;
  align-items: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--brand-primary);
}

.brand img {
  height: 40px;
  margin-right: 10px;
}

.steps {
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

/* ===========================================
   Card Container
   =========================================== */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  min-height: 360px;
}

.card h2 {
  margin: 0 0 8px 0;
  color: var(--brand-primary);
  font-size: 24px;
}

.card .subtitle {
  color: var(--text-secondary);
  margin: 0 0 20px 0;
}

/* ===========================================
   Loading State
   =========================================== */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-secondary);
}

/* ===========================================
   Option Cards (New/Existing Patient)
   =========================================== */

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.option-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--bg-card);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.option-card:hover {
  border-color: var(--brand-secondary);
  transform: translateY(-2px);
}

.option-card.selected {
  border-color: var(--brand-secondary);
  background: var(--bg-selected);
}

.option-card span {
  display: block;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.option-card small {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===========================================
   List Items (Services, Providers, etc.)
   =========================================== */

.list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.list-item {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-card);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.list-item:hover {
  border-color: var(--brand-secondary);
}

.list-item.selected {
  border-color: var(--brand-secondary);
  background: var(--bg-selected);
}

.list-item strong {
  display: block;
  margin-bottom: 4px;
}

.list-item small {
  color: var(--text-secondary);
}

/* ===========================================
   Clinic Selection (Multi-location)
   =========================================== */

.clinic-list {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.clinic-item {
  padding: 20px;
}

.clinic-item .clinic-name {
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--brand-primary);
}

.clinic-item .clinic-address {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 4px;
}

.clinic-item .clinic-phone {
  color: var(--text-secondary);
  font-size: 14px;
}

.clinic-item.selected .clinic-name {
  color: var(--brand-secondary);
}

/* ===========================================
   Form Fields
   =========================================== */

.field {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
}

.field label {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.field input,
.field select {
  padding: 12px 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color 0.2s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--brand-secondary);
}

.field input.error {
  border-color: #e53e3e;
  background: #fff5f5;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.grid .field {
  margin-top: 0;
}

.grid .full-width {
  grid-column: 1 / -1;
}

/* ===========================================
   Time Slots
   =========================================== */

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.slot-button {
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.slot-button:hover {
  border-color: var(--brand-secondary);
}

.slot-button.selected {
  border-color: var(--brand-secondary);
  background: var(--bg-selected);
  font-weight: 600;
}

/* ===========================================
   Buttons
   =========================================== */

.primary,
.secondary {
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary {
  background: var(--brand-secondary);
  color: #fff;
}

.primary:hover:not(:disabled) {
  background: var(--brand-primary);
}

.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary {
  background: #e4e7eb;
  color: var(--text-primary);
}

.secondary:hover {
  background: #d9e2ec;
}

/* ===========================================
   Footer Actions
   =========================================== */

.footer-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

/* ===========================================
   Review Summary
   =========================================== */

.summary {
  background: var(--bg-page);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-top: 20px;
}

.review-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.review-item:last-child {
  border-bottom: none;
}

.review-item .label {
  font-weight: 500;
  color: var(--text-secondary);
}

.review-item .value {
  text-align: right;
  font-weight: 600;
}

.review-item .value small {
  display: block;
  font-weight: 400;
  color: var(--text-secondary);
}

/* ===========================================
   Error States
   =========================================== */

.error {
  color: #e53e3e;
}

p.error {
  background: #fff5f5;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #feb2b2;
}

/* ===========================================
   Utilities
   =========================================== */

.hidden {
  display: none !important;
}

/* ===========================================
   Responsive
   =========================================== */

@media (max-width: 640px) {
  .app {
    padding: 20px 16px 100px;
  }
  
  .card {
    padding: 20px;
  }
  
  .card h2 {
    font-size: 20px;
  }
  
  .option-grid {
    grid-template-columns: 1fr;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
  
  .slots {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .review-item {
    flex-direction: column;
    gap: 4px;
  }
  
  .review-item .value {
    text-align: left;
  }
}
