/* ══════════════════════════════════════════════
   RESERVAS.CSS — Módulo de reservas Physis
   Depende de style.css (variables CSS definidas allí)
   ══════════════════════════════════════════════ */

/* Variables locales del módulo */
:root {
  --slot-free:       #2a7a5a;
  --slot-free-hover: #1e6048;
  --slot-free-light: #e8f5ef;
  --slot-busy:       #b85c5c;
  --slot-busy-hover: #9e4a4a;
  --slot-busy-light: #faeaea;
  --slot-radius:     8px;
  --amber:           #d97706;
  --amber-light:     #fef3c7;
}

/* ── Hero mini ─────────────────────────────── */
.reservas-hero {
  background: var(--primary-dark);
  color: #fff;
  padding: 6rem 0 2.5rem;
  text-align: center;
}
.reservas-hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin: 0 0 .75rem;
}
.reservas-hero p {
  font-size: 1.05rem;
  opacity: .85;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}
.pill-green {
  background: var(--slot-free);
  color: #fff;
  padding: .15em .55em;
  border-radius: 50px;
  font-size: .85em;
  font-weight: 600;
}
.pill-red {
  background: var(--slot-busy);
  color: #fff;
  padding: .15em .55em;
  border-radius: 50px;
  font-size: .85em;
  font-weight: 600;
}

/* ── Layout principal ──────────────────────── */
.reservas-main {
  padding: 2.5rem 1rem 4rem;
  max-width: 860px;
}

/* ── Navegación de mes ─────────────────────── */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.cal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--primary);
  min-width: 220px;
  text-align: center;
  margin: 0;
  text-transform: capitalize;
}
.cal-arrow {
  background: none;
  border: 2px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--primary);
  transition: var(--transition);
  flex-shrink: 0;
}
.cal-arrow:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.cal-arrow svg { width: 18px; height: 18px; }

/* ── Grid del calendario ───────────────────── */
.cal-grid-wrapper {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(30,85,112,.07);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.cal-weekdays span {
  padding: .65rem 0;
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, color .15s;
  position: relative;
  user-select: none;
}
.cal-day:hover:not(.cal-day--disabled):not(.cal-day--past):not(.cal-day--weekend) {
  background: var(--bg-light);
  border-color: var(--accent);
  border-radius: 8px;
  color: var(--primary);
}
.cal-day--selected {
  background: var(--primary) !important;
  color: #fff !important;
  border-radius: 8px;
  border-color: var(--primary) !important;
}
.cal-day--today:not(.cal-day--selected) {
  font-weight: 700;
  color: var(--accent);
}
.cal-day--today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.cal-day--disabled,
.cal-day--past,
.cal-day--weekend {
  color: #bdc8cf;
  cursor: default;
  pointer-events: none;
}
.cal-day--weekend { background: #f9fafb; }
.cal-day--empty { cursor: default; }

/* ── Panel de huecos ───────────────────────── */
.slots-panel {
  margin-top: 2rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(30,85,112,.08);
  animation: panelIn .2s ease;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.slots-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
}
.slots-panel-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: var(--primary);
  margin: 0;
  text-transform: capitalize;
}
.slots-panel-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  opacity: .6;
  transition: opacity .15s;
  padding: 4px;
}
.slots-panel-close:hover { opacity: 1; }
.slots-panel-close svg { width: 20px; height: 20px; display: block; }

/* Tabla de huecos */
.slots-table-wrapper {
  overflow-x: auto;
  padding: 0 1rem 1rem;
}
.slots-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
  margin-top: .75rem;
}
.slots-table th, .slots-table td {
  padding: .5rem .6rem;
  text-align: center;
}
.th-hora {
  width: 80px;
  text-align: left !important;
  color: #666;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.th-fisio { width: calc((100% - 80px) / 2); }
.fisio-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  font-weight: 700;
  color: var(--primary);
  padding: .3rem .7rem;
  border-radius: 50px;
  background: var(--bg-light);
  border: 1px solid var(--border);
}
.fisio-badge svg { width: 15px; height: 15px; }
.fisio-alberto { border-color: #5aabca33; background: #eaf5fa; color: #1e5570; }
.fisio-eva     { border-color: #5aabca33; background: #f0eaf8; color: #4a2e7a; }

/* Separadores de mañana/tarde */
.slots-section-row td {
  background: var(--bg-light);
  color: #888;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .4rem .6rem;
  text-align: left !important;
  border-top: 1px solid var(--border);
}

/* Celda de hora */
.td-hora {
  text-align: left !important;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

/* Botones de slot */
.slot-btn {
  width: 100%;
  max-width: 160px;
  padding: .5rem .75rem;
  border: none;
  border-radius: var(--slot-radius);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  line-height: 1.2;
}
.slot-btn:active { transform: scale(.97); }

.slot-btn--free {
  background: var(--slot-free);
  color: #fff;
}
.slot-btn--free:hover { background: var(--slot-free-hover); }

.slot-btn--busy {
  background: var(--slot-busy-light);
  color: var(--slot-busy);
  border: 1px solid #e8c2c2;
}
.slot-btn--busy:hover {
  background: #f5d5d5;
  color: var(--slot-busy-hover);
}

.slot-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: .7;
}
.slot-btn--free  .slot-dot { background: #fff; opacity: .8; }
.slot-btn--busy  .slot-dot { background: var(--slot-busy); }

/* Leyenda */
.slots-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem;
  padding: .75rem 1.5rem 1rem;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: #666;
  margin: 0;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-free { background: var(--slot-free); }
.dot-busy { background: var(--slot-busy); }

/* ── Confirmación rápida (datos ya guardados) ── */
.quick-confirm { display: flex; flex-direction: column; gap: 1.25rem; }
.quick-confirm-user {
  background: var(--slot-free-light);
  border: 1.5px solid #b3ddc9;
  border-radius: 10px;
  padding: .85rem 1.1rem;
  font-size: .92rem;
  color: var(--text);
  line-height: 1.6;
}

/* ── Modales ────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,25,35,.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 1rem;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: 20px;
  padding: 2rem 2rem 1.75rem;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: slideUp .25s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  transition: color .15s;
  padding: 4px;
  line-height: 0;
}
.modal-close:hover { color: var(--text); }
.modal-close svg { width: 20px; height: 20px; }

/* Modal icons */
.modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.modal-icon svg { width: 26px; height: 26px; }
.modal-icon--green { background: var(--slot-free-light); color: var(--slot-free); }
.modal-icon--amber { background: var(--amber-light); color: var(--amber); }
.modal-icon--dark  { background: var(--bg-light); color: var(--primary); }

/* Modal textos */
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  text-align: center;
  color: var(--primary-dark);
  margin: 0 0 .3rem;
}
.modal-subtitle {
  text-align: center;
  font-size: .9rem;
  color: #555;
  margin: 0 0 1.25rem;
  font-weight: 600;
}
.modal-info {
  background: var(--amber-light);
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: .88rem;
  color: #92400e;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

/* Formularios */
.modal-form { display: flex; flex-direction: column; gap: .85rem; }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.req { color: var(--slot-busy); }
.form-group input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .65rem .9rem;
  font-size: .95rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg-light);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(90,171,202,.15);
  background: #fff;
}
.form-group input.input-error { border-color: var(--slot-busy); }
.form-note {
  font-size: .78rem;
  color: #888;
  margin: 0;
  line-height: 1.5;
}
.form-error {
  font-size: .82rem;
  color: var(--slot-busy);
  font-weight: 600;
  margin: .25rem 0 0;
}
.form-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: .5rem;
  flex-wrap: wrap;
}
.form-actions .btn { min-width: 130px; justify-content: center; }

/* Botón danger */
.btn-danger {
  background: var(--slot-busy);
  color: #fff;
  border: 2px solid var(--slot-busy);
  border-radius: 8px;
  padding: .65rem 1.25rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  font-family: 'Inter', sans-serif;
}
.btn-danger:hover { background: var(--slot-busy-hover); border-color: var(--slot-busy-hover); }

/* Modal success */
.modal-success {
  text-align: center;
  padding: 1rem 0;
}
.modal-success svg {
  width: 48px;
  height: 48px;
  color: var(--slot-free);
  margin-bottom: .75rem;
}
.modal-success p {
  font-size: .95rem;
  color: var(--text);
  line-height: 1.6;
}

/* Admin modal */
.admin-info {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1.1rem;
  font-size: .9rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}
.admin-info strong { color: var(--primary); }
.admin-waitlist {
  margin-bottom: 1rem;
}
.admin-waitlist h4 {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #666;
  margin: 0 0 .5rem;
}
.admin-waitlist ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.admin-waitlist li {
  font-size: .85rem;
  padding: .4rem .75rem;
  background: var(--amber-light);
  border-radius: 6px;
  color: #78350f;
}
.cancel-note {
  font-size: .78rem;
  color: #aaa;
  text-align: center;
  margin: .5rem 0 0;
}

/* ── Toast ─────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark);
  color: #fff;
  padding: .75rem 1.5rem;
  border-radius: 50px;
  font-size: .88rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  animation: toastIn .2s ease;
  white-space: nowrap;
}
.toast[hidden] { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Barra de datos del usuario (wu-strip) ─── */
.wu-strip {
  background: #f0f7fb;
  border-bottom: 1px solid var(--border);
  padding: .9rem 1.5rem;
}
.wu-form { display: flex; flex-direction: column; gap: .55rem; }
.wu-icon {
  width: 18px; height: 18px;
  color: var(--accent);
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  margin-right: .3rem;
}
.wu-label {
  font-size: .82rem;
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.wu-label svg { width: 16px; height: 16px; color: var(--accent); }
.wu-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.wu-input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .5rem .75rem;
  font-size: .88rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: #fff;
  outline: none;
  flex: 1 1 160px;
  min-width: 130px;
  transition: border-color .15s, box-shadow .15s;
}
.wu-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(90,171,202,.15);
}
.wu-input--tel { flex: 1 1 130px; }
.wu-save-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .5rem 1.1rem;
  font-size: .88rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  flex-shrink: 0;
}
.wu-save-btn:hover { background: var(--primary-dark); }
.wu-note { font-size: .78rem; color: var(--slot-busy); margin: 0; font-weight: 600; }

/* Estado guardado */
.wu-saved {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.wu-saved-icon {
  width: 20px; height: 20px;
  color: var(--slot-free);
  flex-shrink: 0;
}
.wu-saved-icon svg { display: block; }
#wuSavedText {
  font-size: .9rem;
  font-weight: 600;
  color: var(--primary);
  flex: 1;
}
.wu-change-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .7rem;
  font-size: .78rem;
  color: #666;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.wu-change-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Botón CANCELAR PROPIA CITA ─────────────── */
.slot-btn--cancel-own {
  background: #fdf0f0;
  color: var(--slot-busy);
  border: 1.5px solid #e8c2c2;
  font-weight: 700;
}
.slot-btn--cancel-own:hover {
  background: var(--slot-busy);
  color: #fff;
}

/* ── Botón EN ESPERA (toggle verde) ─────────── */
.slot-btn--waitlisted {
  background: #e8f5ef;
  color: var(--slot-free);
  border: 1.5px solid #b3ddc9;
  font-weight: 700;
}
.slot-btn--waitlisted:hover {
  background: #d4eddf;
  color: var(--slot-free-hover);
}
.slot-check-svg {
  width: 15px; height: 15px;
  flex-shrink: 0;
}

/* ── Botón OCUPADO — variante sin usuario ─── */
.slot-btn--no-user {
  opacity: .7;
}

/* ── Celda de hueco ocupado (btn + admin) ── */
.slot-cell-busy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  flex-wrap: wrap;
}
.slot-cell-busy .slot-btn {
  flex: 1;
  min-width: 110px;
}

/* Icono + dentro del botón */
.slot-plus {
  font-size: 1.1em;
  font-weight: 700;
  line-height: 1;
  margin-right: .1em;
}

/* Botón admin (mini, discreto) */
.slot-admin-btn {
  background: #ececec;
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: .8rem;
  cursor: pointer;
  color: #888;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot-admin-btn:hover { background: #d5d5d5; color: #333; }

/* Punto de leyenda — en espera */
.dot-waitlisted { background: var(--slot-free); border: 2px solid #b3ddc9; }

/* ── Active nav link ────────────────────────── */
.active-page {
  background: var(--accent) !important;
  color: #fff !important;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 600px) {
  .cal-title { font-size: 1.15rem; min-width: 160px; }
  .modal { padding: 1.5rem 1.25rem; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .slots-table-wrapper { padding: 0 .5rem .5rem; }
  .slots-panel-header { padding: 1rem; }
  .slots-legend { padding: .65rem 1rem .8rem; }
}
