﻿:root {
  --blue: #1a73e8;
  --blue-d: #1558b0;
  --blue-l: #e8f0fe;
  --teal: #00897b;
  --teal-l: #e0f2f1;
  --orange: #f4511e;
  --ink: #1c1c1e;
  --ink-m: #4a4a4f;
  --ink-l: #8e8e93;
  --bg: #f5f5f7;
  --white: #ffffff;
  --border: #e0e0e5;
  --red: #d93025;
  --green: #1e8e3e;
  --yellow: #f9ab00;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 20px rgba(0,0,0,.08);
  --shadow-hover: 0 8px 32px rgba(0,0,0,.12);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* HEADER */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-logo img {
  width: 28px; height: 28px;
  border-radius: 7px;
  object-fit: cover;
}
.header-logo img.clinic-logo {
  width: auto; height: 44px;
  max-width: min(160px, 45vw);
  border-radius: 0;
  object-fit: contain;
}
.header-login {
  padding: 7px 18px;
  border: 1.5px solid var(--blue);
  border-radius: 24px;
  color: var(--blue);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  font-family: 'Outfit', sans-serif;
  transition: all .15s;
}
.header-login:hover { background: var(--blue-l); }

/* USER MENU */
.user-menu-wrap { position: relative; }
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: 40px;
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: all .15s;
  font-family: 'Outfit', sans-serif;
}
.user-menu-trigger:hover { border-color: #bbb; background: var(--bg); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: .5px;
}
.user-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chevron {
  font-size: 10px;
  color: var(--ink-l);
  transition: transform .15s;
}
.user-menu-trigger.open .user-chevron { transform: rotate(180deg); }
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  padding: 6px;
  z-index: 200;
  display: none;
}
.user-dropdown.open { display: block; }
.user-dropdown-header {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.user-dropdown-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.user-dropdown-role {
  font-size: 11.5px;
  color: var(--ink-l);
  margin-top: 1px;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-m);
  cursor: pointer;
  transition: background .12s;
  border: none;
  background: none;
  width: 100%;
  font-family: 'Outfit', sans-serif;
  text-align: left;
}
.user-dropdown-item:hover { background: var(--bg); }
.user-dropdown-item.danger { color: var(--red); }
.user-dropdown-item.danger:hover { background: #fdf2f2; }

/* HERO */
.hero {
  background: linear-gradient(135deg, #1a73e8 0%, #1558b0 100%);
  color: #fff;
  padding: 36px 24px;
  text-align: center;
}
.hero h1 {
  font-family: 'Fraunces', serif;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 12px;
}
.hero h1 em { font-style: italic; font-weight: 300; }
.hero p {
  font-size: 16px;
  opacity: .85;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

/* PROGRESS BAR */
.progress-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: hidden;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-l);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all .15s;
}
.step-item:hover { color: var(--blue); }
.step-item.active { color: var(--blue); border-bottom-color: var(--blue); }
.step-item.done { color: var(--green); }
.step-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}
.step-item.active .step-dot { background: var(--blue); color: #fff; border-color: var(--blue); }
.step-item.done .step-dot { background: var(--green); color: #fff; border-color: var(--green); }
.step-sep { color: var(--border); font-size: 16px; flex-shrink: 0; }

/* MAIN */
.main { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.selcard {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  cursor: pointer;
  transition: all .18s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.selcard:hover { border-color: var(--blue); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.selcard.selected { border-color: var(--blue); background: var(--blue-l); box-shadow: 0 0 0 3px rgba(26,115,232,.12); }
.selcard.selected .selcard-name { color: var(--blue); }
.selcard-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.selcard-name { font-size: 13.5px; font-weight: 500; color: var(--ink); line-height: 1.3; }

.pro-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.procard {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  cursor: pointer;
  transition: all .18s;
  text-align: center;
}
.procard:hover { border-color: var(--blue); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.procard.selected { border-color: var(--blue); background: var(--blue-l); }
.procard-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
  margin: 0 auto 10px;
}
.procard-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.procard-role { font-size: 12px; color: var(--ink-l); }

.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 7px;
  margin-bottom: 16px;
}
.slot {
  padding: 8px 6px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  background: var(--white);
  text-align: center;
}
.slot:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.slot.selected { background: var(--blue); color: #fff; border-color: var(--blue); }
.slot.occupied { background: #fde8e8; border-color: #f5b8b8; color: #c0392b; cursor: not-allowed; }
.slot.occupied:hover { background: #fde8e8; border-color: #f5b8b8; color: #c0392b; }

.summary-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 auto 24px;
  max-width: 520px;
  text-align: left;
}
.summary-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: none; }
.summary-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.summary-label { font-size: 11.5px; color: var(--ink-l); font-weight: 500; text-transform: uppercase; }
.summary-val { font-size: 15px; font-weight: 500; }
.summary-edit { margin-left: auto; color: var(--blue); font-size: 12.5px; cursor: pointer; font-weight: 500; flex-shrink: 0; }

.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 12px; font-weight: 600; color: var(--ink-m); text-transform: uppercase; }
.form-field input, .form-field select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Outfit', sans-serif;
  color: var(--ink);
  outline: none;
  background: var(--white);
  transition: border-color .12s;
}
.form-field input:focus, .form-field select:focus { border-color: var(--blue); }
.form-field input:disabled, 
.form-field select:disabled,
.form-field textarea:disabled {
  background: #f5f5f5;
  border-color: #e0e0e0;
  color: #999;
  cursor: not-allowed;
}

.notice {
  background: var(--teal-l);
  border: 1px solid #a7d7d2;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: #00695c;
  margin-bottom: 20px;
}

.logged-in-banner {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px; color: #2e7d32;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
}

.btn-next {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 28px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: all .15s;
}
.btn-next:hover { background: var(--blue-d); transform: translateY(-1px); }
.btn-next:disabled { background: var(--border); color: var(--ink-l); cursor: not-allowed; }

.btn-gcal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1.5px solid #dadce0;
  background: #fff;
  color: #3c4043;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}
.btn-gcal:hover { box-shadow: 0 1px 6px rgba(60,64,67,.2); border-color: #bbb; }

.cal-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: transparent;
  color: var(--ink-m);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: all .15s;
}
.btn-back:hover { border-color: var(--blue); color: var(--blue); }

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 70px;
}

.login-required-banner {
  background: var(--white);
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  padding: 22px 24px;
  text-align: center;
  margin-bottom: 20px;
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
}
.modal-bg.open { display: flex; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  position: relative;
}
.modal-box h3 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.modal-box p { font-size: 13.5px; color: var(--ink-l); margin-bottom: 20px; }
.modal-close { position: absolute; top: 12px; right: 16px; cursor: pointer; font-size: 20px; color: var(--ink-l); }
.modal-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 14px;
  font-family: 'Outfit', sans-serif;
}
.modal-input:focus { outline: none; border-color: var(--blue); }

.confirm-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  animation: popIn .5s ease;
}

@keyframes popIn {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.main { padding-bottom: 100px; }

/* ── STEP 4: datos + resumen ──────────────────────────────────────── */
.step4-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1000px;
}
.step4-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .step4-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  /* En móvil el resumen (2º columna) se mueve visualmente abajo */
  .step4-layout > div:last-child {
    order: 2;
  }
  .step4-layout > div:first-child {
    order: 1;
  }
  .step4-form-grid {
    grid-template-columns: 1fr;
  }
}

/* ── TOAST NOTIFICATIONS ──────────────────────────────────────────── */
#citas-toast-container {
  position: fixed;
  bottom: 88px; /* above the bottom-bar */
  right: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.citas-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--white);
  border: 1.5px solid var(--border);
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  max-width: 320px;
  pointer-events: all;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .22s, transform .22s;
}
.citas-toast.show { opacity: 1; transform: translateX(0); }
.citas-toast.error   { border-left: 4px solid var(--red);   background: #fff8f8; }
.citas-toast.warning { border-left: 4px solid var(--yellow); background: #fffdf0; }
.citas-toast.success { border-left: 4px solid var(--green);  background: #f4fbf6; }
.citas-toast-icon {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.citas-toast.error   .citas-toast-icon { background: var(--red); }
.citas-toast.warning .citas-toast-icon { background: var(--yellow); }
.citas-toast.success .citas-toast-icon { background: var(--green); }
.citas-toast-body { flex: 1; }
.citas-toast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}
.citas-toast-msg { font-size: 13px; font-weight: 400; color: var(--ink-m); line-height: 1.4; }
.citas-toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--ink-l); font-size: 16px; line-height: 1;
  padding: 0; flex-shrink: 0; margin-top: 1px;
  transition: color .12s;
}
.citas-toast-close:hover { color: var(--ink); }

@media (max-width: 640px) {
  #citas-toast-container {
    left: 12px;
    right: 12px;
    bottom: 80px;
  }
  .citas-toast { max-width: 100%; }
}

/* ── MOBILE RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 640px) {

  /* Hero */
  .hero {
    padding: 28px 16px 24px;
  }
  .hero h1 { font-size: 26px; }
  .hero p  { font-size: 14px; }
  .hero-suffix { display: none; }

  /* Progress bar: scrollable, compact */
  .progress-bar {
    padding: 0 8px;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .progress-bar::-webkit-scrollbar { display: none; }
  .step-item {
    padding: 10px 8px;
    font-size: 11.5px;
    gap: 5px;
    flex-shrink: 0;
  }
  .step-dot { width: 18px; height: 18px; font-size: 9px; }
  .step-sep { font-size: 12px; padding: 0 2px; }

  /* Main content padding */
  .main { padding: 18px 12px 100px; }

  /* Cards grid: single column on very small screens */
  .cards-grid { grid-template-columns: 1fr; }
  .pro-cards  { grid-template-columns: repeat(2, 1fr); }

  /* Bottom bar */
  .bottom-bar {
    padding: 10px 14px;
    height: auto;
    gap: 10px;
  }
  .bottom-summary {
    font-size: 12px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .btn-next { padding: 10px 18px; font-size: 13px; flex-shrink: 0; }
  .btn-back { padding: 8px 14px;  font-size: 13px; flex-shrink: 0; }
}

/* ── Lista de espera opt-in ── */
.le-optin {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin: 20px auto;
  max-width: 460px;
  text-align: left;
}
.le-optin-question {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 14px;
  text-align: center;
}
.le-optin-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.le-btn {
  padding: 9px 22px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  transition: all .15s;
}
.le-btn-yes { background: var(--blue); color: #fff; border-color: var(--blue); }
.le-btn-yes:hover { opacity: .88; }
.le-btn-no  { background: var(--white); color: var(--ink-l); }
.le-btn-no:hover { border-color: var(--ink-l); }
.le-disponibilidad-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.le-disp-btn {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  transition: all .15s;
}
.le-disp-btn:hover { border-color: var(--blue); background: var(--blue-l); }
.le-disp-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
