/* ============================================================
   Vues — page publique (réservation) et tableau de bord admin
   ============================================================ */

/* ---------- En-tête ---------- */
.site-header {
  text-align: center;
  padding: 36px 24px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  position: relative;
}

.site-header .tagline {
  color: var(--muted);
  font-size: 1.02rem;
  margin-top: 6px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  text-align: left;
  padding: 24px;
}

/* ---------- Calendrier ----------
   Largeur bornée : au-delà, les cases carrées deviennent énormes
   et le calendrier perd sa densité de lecture. */
#calendar,
#admin-calendar {
  max-width: 460px;
  margin-inline: auto;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.calendar-header .month-label {
  font-size: 1.1rem;
  text-align: center;
  min-width: 160px;
}

.calendar-nav-btn {
  background: var(--surface-2);
  color: var(--tint);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s var(--ease),
    transform 0.15s var(--ease);
}

.calendar-nav-btn:hover:not(:disabled) {
  background: var(--accent-soft);
}

.calendar-nav-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.calendar-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.calendar-weekdays,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 6px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 4px 0;
}

/* Jours : pas de bordures — des « squircles » qui se remplissent */
.day-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0;
  transition:
    background 0.2s var(--ease),
    transform 0.15s var(--ease);
}

.day-cell:hover:not(:disabled) {
  background: var(--surface-2);
}

.day-cell:active:not(:disabled) {
  transform: scale(0.92);
}

.day-cell.is-selected {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.day-cell:disabled {
  color: var(--muted);
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent;
}

.day-cell.is-empty {
  visibility: hidden;
}

/* Aujourd'hui : chiffre teinté sur fond doux (langage iOS) */
.day-cell.is-today {
  background: var(--accent-soft);
  color: var(--tint);
  font-weight: 700;
}

.day-cell.is-today.is-selected {
  background: var(--accent);
  color: var(--accent-ink);
}

.day-cell.is-today:disabled {
  background: transparent;
  color: var(--muted);
}

.day-cell .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
}

.day-cell.is-selected .dot {
  background: var(--accent-ink);
}

.day-cell .count {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--tint);
  line-height: 1;
}

.day-cell.is-selected .count {
  color: var(--accent-ink);
}

.calendar-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.calendar-legend .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 5px;
}

/* ---------- Créneaux — pastilles ---------- */
.slots-section h3 {
  margin-bottom: 12px;
  font-weight: 600;
}

.slots-group {
  margin-bottom: 16px;
}

.slots-group h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.slot {
  min-height: 44px;
  padding: 11px 8px;
  border: none;
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  transition:
    background 0.2s var(--ease),
    color 0.2s var(--ease),
    transform 0.15s var(--ease);
}

.slot:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--tint);
}

.slot:active:not(:disabled) {
  transform: scale(0.95);
}

.slot.is-selected {
  background: var(--accent);
  color: var(--accent-ink);
}

.slot:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.4;
  text-decoration: line-through;
}

/* ---------- Récapitulatif + formulaire ---------- */
.booking-recap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--accent-soft);
  color: var(--tint);
  border-left: none;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-weight: 600;
}

.booking-form {
  max-width: 520px;
}

/* ---------- Confirmation ---------- */
.success-panel {
  text-align: center;
  padding: 16px 0;
}

.success-panel .check {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
}

.success-panel h2 {
  justify-content: center;
  margin-bottom: 6px;
  font-size: 1.4rem;
}

.success-recap {
  margin: 20px auto;
  max-width: 400px;
  text-align: left;
  background: var(--surface-2);
  border: none;
  border-radius: 14px;
  overflow: hidden;
}

.success-recap div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.success-recap div:last-child {
  border-bottom: none;
}

.success-recap dt {
  color: var(--muted);
  font-size: 0.92rem;
}

.success-recap dd {
  font-weight: 600;
  text-align: right;
}

.success-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ---------- Pied de page ---------- */
.site-footer {
  text-align: center;
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* Seul élément de texte posé sur le fond animé : il lui faut une
   surface opaque, car aucune couleur fixe ne peut tenir le contraste
   sur un dégradé qui alterne zones claires et sombres. */
.admin-access {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* cible tactile confortable */
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition:
    color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.admin-access:hover {
  color: var(--tint);
}

/* ---------- Admin : statistiques ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.stat-tile {
  background: var(--surface-2);
  border: none;
  border-radius: 14px;
  padding: 16px 18px;
}

.stat-tile .value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--tint);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-tile .label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

/* ---------- Admin : listes — rangées iOS ---------- */
.resa-day-group {
  margin-bottom: 18px;
}

.resa-day-group > h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

/* « samedi 5 septembre » → « Samedi 5 septembre » (typographie française) */
.resa-day-group > h3::first-letter,
.calendar-header .month-label::first-letter {
  text-transform: uppercase;
}

.resa-item,
.blocked-item {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: none;
  background: var(--surface-2);
  margin-bottom: 8px;
  border-radius: 14px;
}

.resa-item.is-cancelled {
  opacity: 0.55;
}

.resa-item .time {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--tint);
  font-variant-numeric: tabular-nums;
  min-width: 52px;
}

.resa-item .who {
  flex: 1;
  min-width: 140px;
}

.resa-item .who a {
  color: var(--tint);
  text-decoration: none;
  font-size: 0.9rem;
}

.resa-item .who a:hover {
  text-decoration: underline;
}

.resa-item .notes {
  width: 100%;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.resa-item .actions,
.blocked-item .actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.blocked-item .dates {
  font-weight: 600;
}

.blocked-item .raison {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Admin : horaires ---------- */
.horaire-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.horaire-row:last-of-type {
  border-bottom: none;
}

.horaire-row .jour {
  font-weight: 600;
  width: 92px;
  text-transform: capitalize;
}

.horaire-row .ferme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-left: auto;
  min-height: 44px;
  cursor: pointer;
}

.horaire-row input[type="time"] {
  width: 108px;
  min-height: 40px;
}

.horaire-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.horaire-row.is-closed input[type="time"] {
  opacity: 0.35;
}

.section-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .container {
    padding: 14px 10px 44px;
  }

  .card {
    padding: 18px 12px;
    border-radius: 16px;
  }

  .site-header {
    padding: 26px 16px 24px;
  }

  /* Écart resserré : les cases restent ≥ 44 px (cible tactile) sur 375 px. */
  .calendar-days,
  .calendar-weekdays {
    gap: 3px;
  }

  .day-cell {
    font-size: 0.88rem;
    border-radius: 10px;
  }

  .slots-grid {
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  }

  .slot {
    padding: 10px 4px;
    font-size: 0.9rem;
  }

  .calendar-header .month-label {
    min-width: 0;
    font-size: 1rem;
  }

  .resa-item .actions,
  .blocked-item .actions {
    margin-left: 0;
    width: 100%;
  }
}

/* ---------- Impression (récapitulatif de réservation) ---------- */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .site-footer,
  .admin-access,
  .success-actions,
  .toast-region,
  .calendar-legend {
    display: none !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid #999;
  }
}

/* ---------- Admin : services optionnels ---------- */

/* Même grammaire visuelle que les horaires : une rangée par ligne de
   réglage, le bascule aligné à droite. */
.service-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.service-row:last-of-type {
  border-bottom: none;
}

.service-row__nom {
  font-weight: 600;
  min-width: 92px;
}

.service-row__prix {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.service-row__prix input[type="number"] {
  width: 96px;
  min-height: 44px;
  font-variant-numeric: tabular-nums;
}

.service-row__actif {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-left: auto;
  min-height: 44px;
  cursor: pointer;
}

.service-row__actif input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

/* Service retiré de la réservation : visible mais manifestement en veille. */
.service-row.is-off .service-row__nom,
.service-row.is-off .service-row__prix {
  opacity: 0.45;
}

.service-row .field-error:empty {
  display: none;
}

.service-row .field-error {
  flex-basis: 100%;
}
