/* ============================================================
   DentalSoft — Módulo de Reserva de Turnos
   styles.css — v3.0
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   1. CSS VARIABLES & RESET
───────────────────────────────────────────────────────────── */
:root {
  --brand-primary: #0A6EBD;
  --brand-primary-dark: #084f8c;
  --brand-primary-light: #e8f3fb;
  --brand-primary-glow: rgba(10, 110, 189, 0.15);
  --brand-accent: #00C9A7;
  --brand-accent-light: #e0faf5;

  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --error: #ef4444;
  --error-light: #fee2e2;

  --white: #ffffff;
  --bg-page: #f0f4f8;
  --bg-card: #ffffff;
  --border: #e2e8f0;

  --text-heading: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-placeholder: #94a3b8;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 10px rgba(0,0,0,.06);
  --shadow-brand: 0 4px 20px rgba(10,110,189,.25);
  --shadow-card-hover: 0 8px 24px rgba(10,110,189,.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;

  --spacing-xs: 6px;
  --spacing-sm: 12px;
  --spacing-md: 20px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(.4,0,.2,1);

  --font-display: 'Sora', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-body);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────────────────────
   2. UTILITY
───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─────────────────────────────────────────────────────────────
   3. HERO
───────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0A6EBD 0%, #0d52a0 40%, #084f8c 100%);
  position: relative;
  overflow: hidden;
  padding: var(--spacing-xl) var(--spacing-md) var(--spacing-lg);
  text-align: center;
}

.hero-inner {
  max-width: 640px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(8px);
  color: white;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: var(--spacing-md);
  letter-spacing: 0.3px;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74,222,128,0.3);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(74,222,128,0.3); }
  50%       { box-shadow: 0 0 0 6px rgba(74,222,128,0.1); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: white;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}

.hero-title em {
  font-style: normal;
  color: #7dd3fc;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.75);
  max-width: 460px;
  font-weight: 300;
}

.hero-decoration { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.deco-circle { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,0.08); }
.deco-circle--1 { width: 400px; height: 400px; top: -150px; right: -80px; }
.deco-circle--2 { width: 250px; height: 250px; top: -50px; right: 100px; background: rgba(255,255,255,0.04); }
.deco-circle--3 { width: 180px; height: 180px; bottom: -60px; left: 40px; border-color: rgba(255,255,255,0.06); }

/* ─────────────────────────────────────────────────────────────
   4. STEPPER (4 pasos)
───────────────────────────────────────────────────────────── */
.stepper-wrapper {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: var(--spacing-md);
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.stepper {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.step-bubble {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.step-num {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition-base);
}

.step-check { display: none; width: 16px; height: 16px; stroke: white; }

.step-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--transition-base);
}

.step.active .step-bubble { border-color: var(--brand-primary); background: var(--brand-primary); box-shadow: var(--shadow-brand); }
.step.active .step-num    { color: white; }
.step.active .step-label  { color: var(--brand-primary); font-weight: 600; }

.step.completed .step-bubble { border-color: var(--success); background: var(--success); }
.step.completed .step-num    { display: none; }
.step.completed .step-check  { display: block; }
.step.completed .step-label  { color: var(--success); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  max-width: 100px;
  margin-bottom: 22px;
  min-width: 32px;
  transition: background var(--transition-base);
}
.step-line.completed { background: var(--success); }

/* ─────────────────────────────────────────────────────────────
   5. MAIN LAYOUT
───────────────────────────────────────────────────────────── */
.booking-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg) var(--spacing-md) var(--spacing-xl);
}

.booking-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--spacing-lg);
  align-items: stretch;
}

/* ─────────────────────────────────────────────────────────────
   6. BOOKING CARD
───────────────────────────────────────────────────────────── */
.booking-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  animation: fadeSlideIn var(--transition-slow) both;
  display: flex;
  flex-direction: column;
}
.card-header {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}
.card-footer {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}

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

.card-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-md);
  border-bottom: 1px solid var(--bg-page);
  flex-shrink: 0;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--brand-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-icon svg { width: 22px; height: 22px; stroke: var(--brand-primary); }
.card-icon--success { background: var(--success-light); }
.card-icon--success svg { stroke: var(--success); }

.card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.card-body {
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  flex: 1;
}

.card-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--bg-page);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.card-footer--between { justify-content: space-between; }

/* ─────────────────────────────────────────────────────────────
   7. SECTION DIVIDER
───────────────────────────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─────────────────────────────────────────────────────────────
   8. FORM FIELDS
───────────────────────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 8px; }

.field-label {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-optional {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-page);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
}

.field-required {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--brand-primary);
  background: var(--brand-primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
}

.field-hint { font-size: 0.82rem; color: var(--text-muted); line-height: 1.4; }

.sucursal-info-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--brand-primary-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  color: var(--text-body);
}
.sucursal-info-note svg { flex-shrink: 0; width: 16px; height: 16px; color: var(--brand-primary); }

/* Generic form inputs */
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-body);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  -webkit-appearance: none;
}

.form-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-glow);
}

.form-input::placeholder { color: var(--text-placeholder); }

/* 2-column form grid */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

/* DNI row con botón de búsqueda */
.dni-row { display: flex; flex-direction: column; gap: 14px; }
.dni-row .form-input { width: 100%; }
.btn-dni-lookup {
  align-self: flex-start;
  padding: 0 28px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 46px;
}

/* Estado del input DNI tras la búsqueda */
.dni-input.dni-input--ok {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}
.dni-input.dni-input--err {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239,68,68,.1);
}

/* ─────────────────────────────────────────────────────────────
   9. CUSTOM SELECT
───────────────────────────────────────────────────────────── */
.custom-select-wrapper { position: relative; }

.custom-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-base);
  outline: none;
}

.custom-select:hover { border-color: var(--brand-primary); }
.custom-select:focus,
.custom-select.open {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-glow);
}

.select-placeholder { font-size: 0.9rem; color: var(--text-placeholder); transition: color var(--transition-fast); }
.select-placeholder.has-value { color: var(--text-heading); font-weight: 500; }

.select-arrow { width: 18px; height: 18px; stroke: var(--text-muted); transition: transform var(--transition-base); flex-shrink: 0; }
.custom-select.open .select-arrow { transform: rotate(180deg); }

.custom-select--disabled {
  opacity: 0.55;
  cursor: not-allowed !important;
  pointer-events: none;
}

.select-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1.5px solid var(--brand-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 260px;
  overflow-y: auto;
  display: none;
  animation: dropdownIn 200ms ease;
}
.select-dropdown.open { display: block; }

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-body);
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--bg-page);
}
.select-option:last-child { border-bottom: none; }
.select-option:hover { background: var(--brand-primary-light); }
.select-option.selected { background: var(--brand-primary-light); color: var(--brand-primary); font-weight: 600; }

.select-option .check-icon { width: 16px; height: 16px; stroke: var(--brand-primary); display: none; }
.select-option.selected .check-icon { display: block; }

/* ─────────────────────────────────────────────────────────────
   10. PROFESSIONALS GRID
───────────────────────────────────────────────────────────── */
.professionals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.prof-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--white);
  position: relative;
  overflow: hidden;
}

.prof-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--brand-primary-light), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.prof-card:hover { border-color: var(--brand-primary); box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.prof-card:hover::before { opacity: 1; }

.prof-card.selected {
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
  box-shadow: 0 0 0 3px var(--brand-primary-glow);
}
.prof-card.selected::before { opacity: 1; }

.prof-card-inner { position: relative; z-index: 1; }

.prof-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.prof-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow-sm);
}

.prof-info { flex: 1; min-width: 0; }

.prof-name {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prof-specialty {
  font-size: 0.75rem;
  color: var(--brand-primary);
  font-weight: 500;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prof-details { margin-bottom: 10px; }

.prof-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.77rem;
  color: var(--text-muted);
}
.prof-detail svg { width: 12px; height: 12px; stroke: var(--text-muted); flex-shrink: 0; }

.prof-next-appt {
  background: var(--brand-accent-light);
  border: 1px solid rgba(0,201,167,0.2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.prof-next-label { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.prof-next-value { font-size: 0.78rem; font-weight: 700; color: #00a389; }

.prof-select-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.prof-select-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); background: var(--brand-primary-light); }
.prof-card.selected .prof-select-btn { background: var(--brand-primary); border-color: var(--brand-primary); color: white; }
.prof-select-btn svg { width: 13px; height: 13px; stroke: currentColor; }

/* ─────────────────────────────────────────────────────────────
   11. STEP 2 — OS default chip
───────────────────────────────────────────────────────────── */
.s2-default-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--success-light);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────
   12. STEP 2 — Lista vertical de profesionales
───────────────────────────────────────────────────────────── */
#prof-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.prof-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
  position: relative;
}
.prof-row:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-card-hover);
}
.prof-row.selected {
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
  box-shadow: 0 0 0 3px var(--brand-primary-glow);
}

/* Avatar grande */
.prof-row__avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.6);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
}
.prof-row__avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Columna central (nombre, próximo turno, tags) */
.prof-row__body {
  flex: 1;
  min-width: 0;
}
.prof-row__name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prof-row__next {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #00a389;
  margin-bottom: 6px;
}
.prof-row__next svg { flex-shrink: 0; }
.prof-row__next--loading {
  color: var(--text-muted);
  font-weight: 400;
}
.prof-row__next--none {
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
}
.prof-row__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.spec-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  font-size: 0.7rem;
  font-weight: 600;
}

/* Columna derecha (cobertura OS + botón) */
.prof-row__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.prof-row__coverage {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.cov-ok {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--success);
}
.cov-ok svg { flex-shrink: 0; }
.cov-no {
  color: var(--error);
}
.prof-row__btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-base);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.prof-row__btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); background: var(--brand-primary-light); }
.prof-row.selected .prof-row__btn { background: var(--brand-primary); border-color: var(--brand-primary); color: white; }

/* Responsive: en mobile apilar */
@media (max-width: 520px) {
  .prof-row {
    flex-wrap: wrap;
    gap: 10px;
  }
  .prof-row__right {
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: space-between;
  }
  .prof-row__btn { font-size: 0.75rem; padding: 5px 12px; }
}

/* ─────────────────────────────────────────────────────────────
   13. PASO 3 — Fila de 7 días + botón "Otra fecha"
───────────────────────────────────────────────────────────── */
#dates-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dates-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.dates-row::-webkit-scrollbar { display: none; }

.date-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base), box-shadow var(--transition-base);
  flex-shrink: 0;
  min-width: 58px;
  font-family: var(--font-body);
}
.date-btn:hover:not(:disabled) {
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
}
.date-btn.selected {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  box-shadow: var(--shadow-brand);
}
.date-btn--unavailable {
  opacity: 0.38;
  cursor: not-allowed;
  text-decoration: line-through;
}

.date-btn__day, .date-day-name {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}
.date-btn.selected .date-btn__day,
.date-btn.selected .date-day-name { color: #fff; }

.date-btn__num, .date-day-num {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
}
.date-btn.selected .date-btn__num,
.date-btn.selected .date-day-num { color: #fff; }

.date-btn__mon, .date-month {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
}
.date-btn.selected .date-btn__mon,
.date-btn.selected .date-month { color: #fff; }

.dates-calendar-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-calendar-open {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: border-color var(--transition-base), color var(--transition-base), background var(--transition-base);
  white-space: nowrap;
}
.btn-calendar-open:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-primary-light);
}

.date-custom-selected {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--brand-primary-light);
  border: 1.5px solid rgba(10,110,189,0.3);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-primary);
}
.date-custom-selected svg { flex-shrink: 0; stroke: var(--brand-primary); }

.date-custom-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(10,110,189,0.15);
  cursor: pointer;
  padding: 0;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}
.date-custom-clear:hover { background: rgba(10,110,189,0.3); }
.date-custom-clear svg { stroke: var(--brand-primary); }

/* ─────────────────────────────────────────────────────────────
   13b. POPUP "Otra fecha" — modal de calendario 2 meses
───────────────────────────────────────────────────────────── */
.fecha-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  animation: overlayIn 200ms ease;
}

.fecha-popup-inner {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.2), 0 8px 20px rgba(0,0,0,.12);
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 250ms cubic-bezier(.175,.885,.32,1.275);
}

.fecha-popup-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.fecha-popup-hdr > span {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
}

.fecha-popup-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-page);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.fecha-popup-close-btn:hover { background: var(--border); }
.fecha-popup-close-btn svg { stroke: var(--text-muted); }

#fecha-popup-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.fecha-popup-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.fecha-popup-loading .btn-spinner {
  border-color: rgba(10,110,189,0.3);
  border-top-color: var(--brand-primary);
  width: 18px; height: 18px;
  border-width: 2.5px;
}

.fecha-popup-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────
   13c. CALENDAR GRID (dentro del popup)
───────────────────────────────────────────────────────────── */
.cal-month-header {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
  padding: 16px 0 10px;
  letter-spacing: -0.1px;
}
.cal-month-header:first-child { padding-top: 0; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.cal-weekday {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  padding: 4px 0 8px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
}

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

.cal-day--past {
  color: var(--text-placeholder);
  cursor: default;
}

.cal-day--unavail {
  color: var(--text-placeholder);
  cursor: not-allowed;
  text-decoration: line-through;
  opacity: 0.4;
}

.cal-day--avail {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  font-weight: 600;
  cursor: pointer;
}
.cal-day--avail:hover {
  background: rgba(10,110,189,0.22);
  color: var(--brand-primary-dark);
}

.cal-day--selected {
  background: var(--brand-primary) !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: var(--shadow-brand);
}

.cal-month-sep {
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

/* ─────────────────────────────────────────────────────────────
   12. HOURS
───────────────────────────────────────────────────────────── */
.hours-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: var(--spacing-lg);
  background: var(--bg-page);
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border);
  text-align: center;
  color: var(--text-muted);
}
.hours-placeholder svg { width: 36px; height: 36px; opacity: 0.4; }
.hours-placeholder p   { font-size: 0.875rem; line-height: 1.6; }

.hours-container { display: flex; flex-direction: column; gap: var(--spacing-md); }

.hours-slots { display: flex; flex-wrap: wrap; gap: 8px; }

.hour-btn {
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-body);
  transition: all var(--transition-base);
  min-width: 70px;
  text-align: center;
}
.hour-btn:hover:not(:disabled) { border-color: var(--brand-primary); color: var(--brand-primary); background: var(--brand-primary-light); }
.hour-btn.selected { background: var(--brand-primary); border-color: var(--brand-primary); color: white; box-shadow: var(--shadow-brand); }

.hours-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--spacing-md);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.hours-empty { padding: var(--spacing-md); background: var(--bg-page); border-radius: var(--radius-md); text-align: center; color: var(--text-muted); font-size: 0.875rem; }

/* ─────────────────────────────────────────────────────────────
   13. TEXTAREA
───────────────────────────────────────────────────────────── */
.textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-body);
  resize: vertical;
  min-height: 90px;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  outline: none;
  background: var(--white);
}
.textarea:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-primary-glow); }
.textarea::placeholder { color: var(--text-placeholder); }
.textarea-counter { font-size: 0.75rem; color: var(--text-muted); text-align: right; }

/* ─────────────────────────────────────────────────────────────
   14. CONFIRMATION SUMMARY GRID
───────────────────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: var(--bg-page);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.summary-item--full      { grid-column: 1 / -1; }
.summary-item--highlight { background: var(--brand-primary-light); border-color: rgba(10,110,189,0.2); }

.summary-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.summary-label svg { width: 12px; height: 12px; stroke: var(--text-muted); }

.summary-value { font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; color: var(--text-heading); line-height: 1.3; }
.summary-value--pending { color: var(--text-muted); font-weight: 400; font-style: italic; font-size: 0.85rem; }
.summary-value--price   { color: var(--brand-primary); font-size: 1.1rem; }

.validation-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: var(--error-light);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  color: #b91c1c;
  font-size: 0.875rem;
  font-weight: 500;
}
.validation-error svg { width: 18px; height: 18px; stroke: #b91c1c; flex-shrink: 0; margin-top: 1px; }

/* ─────────────────────────────────────────────────────────────
   15. BUTTONS
───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  min-height: 46px;
}
.btn svg { width: 16px; height: 16px; stroke: currentColor; flex-shrink: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn--primary { background: var(--brand-primary); color: white; box-shadow: var(--shadow-brand); }
.btn--primary:hover:not(:disabled) { background: var(--brand-primary-dark); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(10,110,189,.35); }
.btn--primary:active { transform: translateY(0); }

.btn--confirm {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(16,185,129,.3);
  padding: 14px 28px;
  font-size: 0.95rem;
}
.btn--confirm:hover:not(:disabled) { background: linear-gradient(135deg, #059669 0%, #047857 100%); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(16,185,129,.4); }

.btn--ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn--ghost:hover { border-color: var(--text-muted); color: var(--text-heading); background: var(--bg-page); }

.btn--full { width: 100%; }

/* Spinner en botón de búsqueda */
.btn-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────────────────────
   16. SIDEBAR SUMMARY WIDGET
───────────────────────────────────────────────────────────── */
.booking-summary-col { display: flex; flex-direction: column; }

.summary-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
}

.summary-widget-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px var(--spacing-md);
  background: var(--text-heading);
  color: white;
  flex-shrink: 0;
}
.summary-widget-header svg { width: 18px; height: 18px; stroke: rgba(255,255,255,0.7); }
.summary-widget-header span { font-family: var(--font-display); font-size: 0.9rem; font-weight: 600; letter-spacing: -0.1px; }

.summary-widget-body {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.sw-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg-page);
}
.sw-row:last-child { border-bottom: none; }

.sw-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.sw-value { font-family: var(--font-display); font-size: 0.9rem; font-weight: 600; color: var(--text-heading); }
.sw-value--pending { color: var(--text-placeholder); font-weight: 400; font-style: italic; font-size: 0.82rem; }

.summary-widget-footer {
  padding: 14px var(--spacing-md);
  background: var(--bg-page);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.summary-hint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.summary-hint svg { width: 13px; height: 13px; stroke: var(--text-muted); flex-shrink: 0; margin-top: 2px; }

/* ─────────────────────────────────────────────────────────────
   17. PATIENT FOUND — badge + form disabled + actions
───────────────────────────────────────────────────────────── */

/* Badge de paciente encontrado (reemplaza la card compleja) */
.pf-found-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--success-light);
  border: 1.5px solid rgba(16,185,129,.35);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--success);
  animation: fadeSlideIn var(--transition-slow) both;
}
.pf-found-badge svg { width: 15px; height: 15px; stroke: var(--success); flex-shrink: 0; }

/* Fila OS + Plan (lado a lado) */
.os-plan-row {
  display: flex;
  gap: var(--spacing-md);
}
.os-plan-row .field-group {
  flex: 1;
  min-width: 0;
}
.os-plan-row .field-group.hidden {
  display: none;
}

/* Sublabel dentro de una opción del custom select (ej: "Obra social del paciente") */
.select-option-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: 1px;
  line-height: 1.2;
}

/* Input deshabilitado (campos del formulario en modo lectura) */
.form-input--disabled,
.form-input:disabled {
  background: var(--bg-page);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.85;
  border-color: var(--border) !important;
  box-shadow: none !important;
}

/* Botones de acción para paciente encontrado */
.pf-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pf-btn-continue {
  flex: 1;
  justify-content: center;
  padding: 12px 16px;
  font-size: 0.9rem;
}
.pf-btn-continue svg { width: 15px; height: 15px; }

.pf-btn-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 16px;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.pf-btn-edit svg { width: 13px; height: 13px; }

/* Wrapper de campos del paciente (aparece cuando DNI no es encontrado) */
#patient-fields-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  animation: fadeSlideIn var(--transition-slow) both;
}

/* ─────────────────────────────────────────────────────────────
   17b. PATIENT NOT FOUND CARD
───────────────────────────────────────────────────────────── */
.patient-not-found-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--error-light);
  border: 1.5px solid rgba(239,68,68,.25);
  border-radius: var(--radius-md);
  animation: fadeSlideIn var(--transition-slow) both;
}

.pnf-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: white;
  border: 1px solid rgba(239,68,68,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pnf-icon svg { width: 20px; height: 20px; stroke: var(--error); }

.pnf-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--error);
  margin-bottom: 3px;
}

.pnf-text p {
  font-size: 0.82rem;
  color: #7f1d1d;
  line-height: 1.45;
  margin: 0;
}

/* ─────────────────────────────────────────────────────────────
   18. MODAL
───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  animation: overlayIn 300ms ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl) var(--spacing-lg);
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0,0,0,.25), 0 10px 25px rgba(0,0,0,.15);
  text-align: center;
  animation: modalIn 350ms cubic-bezier(.175,.885,.32,1.275);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.88) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-success-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border: 3px solid var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--spacing-md);
  box-shadow: 0 0 0 8px rgba(16,185,129,.12);
  animation: successPop 500ms 200ms cubic-bezier(.175,.885,.32,1.275) both;
}
@keyframes successPop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-success-icon svg { width: 36px; height: 36px; stroke: var(--success); }

.modal-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--text-heading); margin-bottom: 10px; letter-spacing: -0.3px; }
.modal-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-bottom: var(--spacing-lg); line-height: 1.5; }

.modal-summary {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.modal-row-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }
.modal-row-value { font-family: var(--font-display); font-size: 0.88rem; font-weight: 700; color: var(--text-heading); text-align: right; }

.modal-actions { display: flex; flex-direction: column; gap: 10px; }

/* ─────────────────────────────────────────────────────────────
   19. RESPONSIVE
───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .booking-layout { grid-template-columns: 1fr; align-items: start; }
  .booking-summary-col { order: -1; }
  .summary-widget { position: static; max-height: none; flex: none; }
  .summary-widget-body { display: grid; grid-template-columns: repeat(2, 1fr); }
  .sw-row { border-right: 1px solid var(--bg-page); padding: 10px; }
  .sw-row:nth-child(2n) { border-right: none; }
}

@media (max-width: 768px) {
  .hero { padding: var(--spacing-lg) var(--spacing-md); }
  .hero-title { font-size: 2rem; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .stepper-wrapper { top: 0; }
  .step-label { display: none; }
  .step-line  { max-width: 50px; }
  .booking-main { padding: var(--spacing-md) var(--spacing-sm) var(--spacing-xl); }
  .card-header { padding: var(--spacing-md); gap: 12px; }
  .card-body   { padding: var(--spacing-md); gap: var(--spacing-md); }
  .card-footer { padding: 14px var(--spacing-md); }
  .professionals-grid { grid-template-columns: 1fr 1fr; }
  .pf-actions { flex-direction: column; }
  .pf-btn-continue { width: 100%; }
  .pf-btn-edit { width: 100%; justify-content: center; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-item--full { grid-column: 1; }
  .modal { padding: var(--spacing-lg) var(--spacing-md); border-radius: var(--radius-lg); }
  .modal-title { font-size: 1.2rem; }
  .summary-widget-body { display: flex; flex-direction: column; }
}

@media (max-width: 480px) {
  .professionals-grid { grid-template-columns: 1fr; }
  .patient-not-found-card { flex-direction: column; }
  .os-plan-row { flex-direction: column; }
  .hours-slots  { gap: 6px; }
  .hour-btn     { min-width: 60px; padding: 8px 10px; font-size: 0.82rem; }
  .card-footer--between { flex-direction: column-reverse; gap: 10px; }
  .card-footer--between .btn { width: 100%; justify-content: center; }
}

/* ─────────────────────────────────────────────────────────────
   20. SCROLLBAR
───────────────────────────────────────────────────────────── */
.select-dropdown::-webkit-scrollbar,
.summary-widget-body::-webkit-scrollbar { width: 5px; }
.select-dropdown::-webkit-scrollbar-track,
.summary-widget-body::-webkit-scrollbar-track { background: var(--bg-page); }
.select-dropdown::-webkit-scrollbar-thumb,
.summary-widget-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
