/* ══════════════════════════════════════════════
   RESERVAS.CSS — Módulo de reservas
   La Maestra de Javi · Peluquería & Barbería
   Archivo autocontenido (no depende de style.css)
   ══════════════════════════════════════════════ */

/* ── Variables del módulo ──────────────────── */
:root {
  --primary:       #CC0000;
  --primary-dark:  #a30000;
  --text:          #111111;
  --text-soft:     #555555;
  --border:        #e0e0e0;
  --bg-light:      #f7f7f7;
  --accent:        #CC0000;
  --transition:    all .2s ease;

  --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;
}

/* ── Reset mínimo ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: #fff;
}

/* ── Container ─────────────────────────────── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Botones globales ──────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: 2px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ── HEADER / NAVBAR ───────────────────────── */
.res-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(17,17,17,.97);
  border-bottom: 2px solid var(--primary);
  z-index: 1000;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.res-logo {
  font-family: 'Lobster Two', cursive;
  font-size: 1.45rem;
  color: #fff;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.res-logo span { color: var(--primary); }

.res-nav-links {
  display: flex;
  list-style: none;
  margin: 0; padding: 0;
  gap: 1.5rem;
}
.res-nav-links a {
  color: #999;
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  transition: color .2s;
}
.res-nav-links a:hover { color: #fff; }
.res-nav-links a.active-page {
  color: #fff;
  font-weight: 700;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 2px;
}

.res-nav-back {
  color: #999;
  text-decoration: none;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  transition: color .2s;
}
.res-nav-back:hover { color: #fff; }
.res-nav-back svg { width: 16px; height: 16px; }

@media (max-width: 600px) {
  .res-nav-links { display: none; }
}

/* ── Hero mini ─────────────────────────────── */
.reservas-hero {
  background: #111;
  color: #fff;
  padding: 7rem 0 3rem;
  text-align: center;
  border-bottom: 3px solid var(--primary);
}
.reservas-hero h1 {
  font-family: 'Lobster Two', cursive;
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 .6rem;
}
.reservas-hero h1 span { color: var(--primary); }
.reservas-hero p {
  font-size: 1rem;
  opacity: .8;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}
.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 5rem;
  max-width: 680px;
}

/* ── 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(0,0,0,.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);
}
.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: #fdf0f0;
  border-color: var(--primary);
  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(--primary);
}
.cal-day--today::after {
  content: '';
  position: absolute;
  bottom: 4px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--primary);
}
.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(0,0,0,.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: 280px;
  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-javi { width: calc(100% - 80px); }

.javi-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  font-weight: 700;
  color: var(--primary-dark);
  padding: .3rem .7rem;
  border-radius: 50px;
  background: #fdf0f0;
  border: 1px solid #f5c0c0;
}
.javi-badge svg { width: 15px; height: 15px; }

/* Separadores 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);
}

.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: 200px;
  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); }
.slot-plus { font-size: 1.1em; font-weight: 700; line-height: 1; margin-right: .1em; }
.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; }
.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-btn--no-user { opacity: .7; }
.slot-check-svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Celda ocupada */
.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; }

/* Botón admin mini */
.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; }

/* 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); }
.dot-waitlisted { background: var(--slot-free); border: 2px solid #b3ddc9; }

/* ── Barra de datos del usuario ────────────── */
.wu-strip { background: #fdf7f7; border-bottom: 1px solid var(--border); padding: .9rem 1.5rem; }
.wu-form { display: flex; flex-direction: column; gap: .55rem; }
.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(--primary); }
.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(--primary); box-shadow: 0 0 0 3px rgba(204,0,0,.12); }
.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; }
.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); }

/* ── Confirmación rápida ───────────────────── */
.quick-confirm { display: flex; flex-direction: column; gap: 1.1rem; }
.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(0,0,0,.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-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: #f0f0f0; color: var(--primary); }

.modal-title { font-family: 'Playfair Display', serif; font-size: 1.35rem; text-align: center; color: #111; 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; }

.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,
.form-group select {
  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;
  width: 100%;
}
.form-group select { cursor: pointer; appearance: auto; }
.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(204,0,0,.12);
  background: #fff;
}
.form-group input.input-error,
.form-group select.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; }

.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 { 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: #111; 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); }
}

/* ── 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; }
  .wu-strip { padding: .75rem 1rem; }
  .reservas-hero { padding: 6rem 1rem 2.5rem; }
}
