/* ============ FENÊTRE DE RENDEZ-VOUS (diagnostic gratuit) ============
   Disposition en trois colonnes : infos | calendrier | heures.
   Balisage : resources/views/partials/booking-modal.blade.php · logique : public/js/booking.js
   Les couleurs viennent des variables de style.css. */

.bk-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10, 14, 26, .62); backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
}
.bk-overlay.is-open { opacity: 1; visibility: visible; }

.bk {
  /* Taille fixe : la carte ne change pas de hauteur d'une étape à l'autre, c'est le contenu qui défile. */
  width: min(1040px, 100%); height: min(680px, 94vh);
  display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  background: #fff; border-radius: 22px; overflow: hidden;
  box-shadow: 0 40px 100px -20px rgba(10, 14, 26, .6);
  transform: translateY(16px) scale(.98); transition: transform .25s cubic-bezier(.2, .7, .2, 1);
}
.bk:focus { outline: none; }
.bk-overlay.is-open .bk { transform: none; }
.bk-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ── Colonne d'information (à gauche) ── */
.bk-side {
  display: flex; flex-direction: column; gap: 14px; padding: 32px 28px; overflow-y: auto;
  background: var(--bg-panel); border-right: 1px solid var(--gray-light);
}
.bk-brand img { height: 46px; width: auto; border-radius: 8px; }
.bk-org { margin-top: 2px; font-size: .88rem; font-weight: 700; color: var(--text-muted); }
.bk-side h2 { font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 1.75rem; line-height: 1.15; color: var(--navy); }
.bk-facts { list-style: none; display: grid; gap: 10px; }
.bk-facts li { display: flex; align-items: flex-start; gap: 10px; font-size: .95rem; font-weight: 600; line-height: 1.4; color: var(--navy); }
.bk-facts svg { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; color: var(--teal-dark); }
.bk-recap { display: none; padding-top: 14px; border-top: 1px dashed var(--gray-light); }
.bk-recap.is-visible { display: grid; animation: bkIn .25s ease both; }
.bk-about { margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--gray-light); }
.bk-about strong { display: block; margin-bottom: 8px; font-size: .95rem; color: var(--navy); }
.bk-about p { font-size: .9rem; line-height: 1.7; color: var(--gray); }

/* ── Zone principale (à droite) ── */
.bk-main { position: relative; display: flex; flex-direction: column; min-height: 0; padding: 30px 32px 28px; overflow: hidden; }
.bk-close {
  position: absolute; top: 16px; right: 16px; z-index: 3; width: 38px; height: 38px; border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer; background: #f1f3f8; color: #5a6480;
  transition: background .2s, transform .2s;
}
.bk-close:hover { background: #e4e7f0; transform: rotate(90deg); }
.bk-close svg { width: 17px; height: 17px; }

.bk-h { font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 1.55rem; line-height: 1.2; color: var(--navy); margin-bottom: 18px; }
.bk-h:focus { outline: none; }

.bk-pane { display: none; flex: 1; flex-direction: column; min-height: 0; }
.bk-pane.is-active { display: flex; animation: bkIn .25s ease both; }
.bk-pane[data-pane="1"].is-active, .bk-pane[data-pane="3"].is-active { overflow-y: auto; }
@keyframes bkIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Calendrier + heures ── */
.bk-cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 28px; flex: 1; min-height: 0; }
.bk-cal { display: flex; flex-direction: column; min-height: 0; padding-right: 44px; }
.bk-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bk-cal-head strong { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.4rem; color: var(--navy); }
.bk-cal-head strong span { font-weight: 600; color: var(--text-muted); }
.bk-nav { display: inline-flex; gap: 2px; }
.bk-nav button {
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--navy);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s;
}
.bk-nav button:hover:not(:disabled) { background: rgba(30, 158, 145, .12); }
.bk-nav button:disabled { color: #b3b9c9; cursor: not-allowed; }
.bk-nav svg { width: 18px; height: 18px; }

.bk-dow, .bk-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px 6px; }
.bk-dow span { text-align: center; padding: 8px 0; font-size: 11px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; color: var(--navy); }
.bk-grid-wrap { position: relative; }
.bk-day {
  position: relative; width: 100%; max-width: 60px; height: 54px; justify-self: center; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: #aab1c3; font: 600 .98rem 'Inter', sans-serif; cursor: default;
  transition: background .15s, color .15s;
}
.bk-day.is-ok { background: rgba(30, 158, 145, .13); color: var(--navy); font-weight: 800; cursor: pointer; }
.bk-day.is-ok:hover { background: rgba(30, 158, 145, .26); }
.bk-day.is-sel, .bk-day.is-sel:hover { background: var(--navy); color: #fff; }
.bk-day.is-today { color: var(--navy); font-weight: 800; }
.bk-day.is-sel.is-today { color: #fff; }
.bk-day.is-today::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--or); }
.bk-day.is-sel.is-today::after { background: #f0c060; }
.bk-day:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; }
.bk-grid.is-loading .bk-day { background: #eef1f6; animation: bkPulse 1s ease-in-out infinite alternate; }
@keyframes bkPulse { from { opacity: .45; } to { opacity: 1; } }

/* Mois sans disponibilité (comme « Aucune disponibilité en octobre ») */
.bk-nomonth { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.bk-nomonth[hidden] { display: none; }
.bk-nomonth span {
  padding: 22px 34px; border: 1px solid var(--gray-light); border-radius: 14px; background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 30px -12px rgba(30, 45, 90, .3); font-size: .95rem; font-weight: 600; color: var(--navy);
}

.bk-msg { min-height: 22px; margin-top: 10px; font-size: .88rem; color: var(--text-muted); }
.bk-msg.is-err { color: #c0342c; font-weight: 600; }
.bk-msg a { color: var(--navy); font-weight: 700; }

.bk-tz { display: flex; flex-direction: column; gap: 8px; margin-top: auto; font-size: .88rem; font-weight: 800; color: var(--navy); }
.bk select, .bk input, .bk textarea { font-family: 'Inter', sans-serif; }
.bk-tz select {
  width: 100%; height: 46px; padding: 0 12px; border: 1.5px solid var(--gray-light); border-radius: 12px; background: #fff;
  color: var(--text); font-size: .92rem; font-weight: 500;
}
.bk-tz select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(30, 158, 145, .18); }

/* ── Colonne des heures ── */
.bk-slots { display: flex; flex-direction: column; min-height: 0; padding-left: 24px; border-left: 1px solid #edf1f7; }
.bk-slots h4 { padding: 6px 34px 0 0; margin-bottom: 14px; font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .95rem; line-height: 1.3; color: var(--navy); }
.bk-slot-list { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.bk-slot {
  flex: 0 0 auto; min-height: 46px; border: 1.5px solid rgba(30, 158, 145, .5); border-radius: 12px; background: #fff; color: var(--teal-dark);
  font: 800 .95rem 'Inter', sans-serif; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.bk-slot:hover { background: rgba(30, 158, 145, .1); border-color: var(--teal); }
.bk-slot.is-sel, .bk-slot.is-sel:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.bk-slot:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; }
.bk-slots-empty { font-size: .88rem; line-height: 1.6; color: var(--text-muted); }
.bk-slots-foot { padding-top: 14px; }

/* ── Boutons ── */
.bk-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 30px; border: none; border-radius: 30px;
  background: var(--or); color: var(--navy); font: 800 15px 'Inter', sans-serif; cursor: pointer;
  box-shadow: 0 6px 20px rgba(206, 156, 31, .32); transition: background .2s, box-shadow .2s, transform .15s;
}
.bk-btn:hover:not(:disabled) { background: var(--or-hover); box-shadow: 0 10px 26px rgba(206, 156, 31, .42); transform: translateY(-1px); }
.bk-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.bk-btn:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.bk-btn svg { width: 18px; height: 18px; }
.bk-btn-block { width: 100%; }
.bk-btn-ghost { background: transparent; color: var(--navy); border: 2px solid var(--navy); box-shadow: none; }
.bk-btn-ghost:hover:not(:disabled) { background: var(--navy); color: #fff; box-shadow: none; }

/* ── Formulaire : seuls les champs défilent, le bouton reste visible ── */
.bk-back { align-self: flex-start; margin: -4px 0 10px; padding: 4px 0; border: none; background: none; color: var(--text-muted); font: 700 .88rem 'Inter', sans-serif; cursor: pointer; }
.bk-back:hover { color: var(--navy); }
.bk-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.bk-form-fields { display: grid; gap: 14px; align-content: start; flex: 1; min-height: 0; overflow-y: auto; padding: 2px 8px 16px 2px; margin-right: -8px; }
.bk-form-foot { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid #edf1f7; }
.bk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bk-field { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; font-weight: 700; color: var(--navy); }
.bk-field .req { color: #c0342c; font-style: normal; }
.bk-field input, .bk-field select, .bk-field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--gray-light); border-radius: 12px; background: #fff; color: var(--text);
  font-size: .95rem; font-weight: 400; transition: border-color .2s, box-shadow .2s;
}
.bk-field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.bk-field input:focus, .bk-field select:focus, .bk-field textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(30, 158, 145, .18); }
.bk-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 14px; background: #f1f3f8; }
.bk-seg[hidden] { display: none; }
.bk-seg label { position: relative; }
.bk-seg input { position: absolute; opacity: 0; inset: 0; }
.bk-seg span { display: block; padding: 10px; border-radius: 10px; text-align: center; font-weight: 800; font-size: .92rem; color: var(--text-muted); cursor: pointer; transition: background .2s, color .2s; }
.bk-seg input:checked + span { background: #fff; color: var(--navy); box-shadow: 0 2px 8px rgba(30, 45, 90, .12); }
.bk-seg input:focus-visible + span { outline: 3px solid var(--or); outline-offset: 1px; }
.bk-error { padding: 11px 14px; border-radius: 10px; background: rgba(192, 52, 44, .08); color: #c0342c; font-size: .9rem; font-weight: 600; }
.bk-error[hidden] { display: none; }
.bk-note { text-align: center; font-size: .82rem; color: var(--text-muted); }

/* ── Confirmation ── */
.bk-done { margin: auto; max-width: 440px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.bk-done-icon { width: 76px; height: 76px; margin-bottom: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--teal-dark); background: rgba(30, 158, 145, .14); }
.bk-done-icon svg { width: 40px; height: 40px; }
.bk-done .bk-h { margin-bottom: 14px; }
.bk-done-card { width: 100%; padding: 16px 18px; border-radius: 14px; text-align: left; background: #f8f7f3; border-left: 4px solid var(--or); display: flex; flex-direction: column; gap: 3px; }
.bk-done-card strong { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.1rem; color: var(--navy); }
.bk-done-card span { font-size: .88rem; color: var(--text-muted); }
.bk-done p { margin: 14px 0 20px; font-size: .95rem; line-height: 1.6; color: var(--gray); }
.bk-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

/* ── Bouton « Prendre rendez-vous » du menu mobile ── */
.mobile-menu a.mobile-cta {
  margin-top: 14px; padding: 14px 20px; border: none; border-radius: 30px; text-align: center;
  background: var(--or); color: var(--navy); font-weight: 800; box-shadow: 0 6px 20px rgba(206, 156, 31, .3);
}

/* ── Écrans moyens : colonnes plus étroites ── */
@media (max-width: 1040px) {
  .bk { grid-template-columns: 260px minmax(0, 1fr); }
  .bk-side { padding: 28px 22px; }
  .bk-main { padding: 28px 24px 24px; }
  .bk-cal-wrap { grid-template-columns: minmax(0, 1fr) 170px; gap: 20px; }
  .bk-cal { padding-right: 32px; }
  .bk-slots { padding-left: 18px; }
}

/* ── Tablette et mobile : une seule colonne, la feuille défile ── */
@media (max-width: 820px) {
  .bk-overlay { padding: 0; align-items: flex-end; }
  .bk { grid-template-columns: 1fr; grid-template-rows: none; align-content: start; height: 96vh; height: 96dvh; overflow-y: auto; border-radius: 22px 22px 0 0; }
  /* Infos réduites à l'essentiel : le calendrier doit rester visible sans défiler */
  .bk-side { padding: 18px 22px 16px; gap: 10px; overflow: visible; border-right: 0; border-bottom: 1px solid var(--gray-light); }
  .bk-brand, .bk-org, .bk-about { display: none; }
  .bk-side h2 { font-size: 1.3rem; padding-right: 44px; }
  .bk-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; }
  .bk-facts li { font-size: .85rem; }
  .bk-facts svg { flex-basis: 18px; width: 18px; height: 18px; }
  .bk-recap { display: none; padding-top: 10px; }
  .bk-recap.is-visible { display: grid; gap: 6px; }
  .bk-main { overflow: visible; padding: 22px 22px 0; }
  .bk-pane { flex: none; min-height: auto; }
  .bk-cal-wrap { flex: none; }
  .bk-cal, .bk-slots { min-height: auto; }
  .bk-pane[data-pane="1"].is-active, .bk-pane[data-pane="3"].is-active { overflow: visible; }
  .bk-close { position: fixed; top: 12px; right: 12px; background: rgba(255, 255, 255, .95); box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }

  .bk-cal-wrap { grid-template-columns: 1fr; gap: 18px; }
  .bk-cal { padding-right: 0; }
  .bk-tz { margin-top: 16px; }
  .bk-slots { padding-left: 0; border-left: 0; }
  .bk-slots.is-empty { display: none; }
  .bk-slot-list { flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .bk-slot { flex: 1 0 28%; }
  /* Le bouton « Suivant » reste accessible pendant le défilement */
  .bk-slots-foot { position: sticky; bottom: 0; z-index: 2; padding: 12px 0 16px; background: #fff; }

  .bk-form { flex: none; }
  .bk-form-fields { overflow: visible; flex: none; margin-right: 0; padding: 2px 0 16px; }
  .bk-form-foot { position: sticky; bottom: 0; z-index: 2; padding: 12px 0 16px; background: #fff; }
  .bk-pane[data-pane="3"] { padding-bottom: 24px; }
}
@media (max-width: 520px) {
  .bk-day { height: 42px; font-size: .9rem; }
  .bk-row { grid-template-columns: 1fr; }
  .bk-h { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bk-overlay, .bk, .bk-pane.is-active, .bk-recap.is-visible, .bk-grid.is-loading .bk-day { animation: none; transition: none; }
  .bk-close:hover, .bk-btn:hover:not(:disabled) { transform: none; }
}
