/**
 * Pyrenair Booking — Styles front
 * Palette alignée avec pyrenair-locations.fr :
 *   - Rouge bordeaux #a61e22  (accent principal)
 *   - Gris anthracite #1f2937 (texte)
 *   - Gris moyen #6b7280
 *   - Fond clair #f9fafb
 *   - Cards radius 20px, ombres douces
 */

.pb-booking {
  --pb-accent:       #a61e22;
  --pb-accent-dark:  #7c1316;
  --pb-accent-soft:  #fbe9ea;
  --pb-text:         #1f2937;
  --pb-text-soft:    #6b7280;
  --pb-text-light:   #9ca3af;
  --pb-border:       #e5e7eb;
  --pb-border-soft:  #f1f5f9;
  --pb-bg:           #ffffff;
  --pb-bg-soft:      #f9fafb;
  --pb-success:      #059669;
  --pb-warning:      #d97706;
  --pb-danger:       #dc2626;
  --pb-shadow-sm:    0 4px 12px rgba(15, 23, 42, 0.04);
  --pb-shadow:       0 14px 28px rgba(15, 23, 42, 0.06);
  --pb-radius:       20px;
  --pb-radius-sm:    12px;

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--pb-text);
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
}

.pb-booking *,
.pb-booking *::before,
.pb-booking *::after { box-sizing: border-box; }

/* Reset agressif des boutons à l'intérieur du tunnel pour éviter que le
   thème WordPress n'applique des styles parasites (border-radius circulaire,
   shadows, transforms…). On exclut .pb-btn et autres éléments qui ont
   leur propre style appliqué juste après. */
.pb-booking button:not(.pb-btn):not(.pb-qty-btn):not(.pb-nav-btn) {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  text-shadow: none;
}

/* =======================================================================
   BREADCRUMB ÉTAPES
   ======================================================================= */

.pb-steps {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  flex-wrap: wrap;
}

.pb-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--pb-bg-soft);
  border-radius: 999px;
  font-size: 14px;
  color: var(--pb-text-soft);
  cursor: default;
  transition: all .2s ease;
}

.pb-step.is-active {
  background: var(--pb-accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(166, 30, 34, 0.25);
}

.pb-step.is-done {
  background: var(--pb-accent-soft);
  color: var(--pb-accent);
  cursor: pointer;
}
.pb-step.is-done:hover { background: #f5d9da; }

.pb-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-weight: 700;
  font-size: 13px;
}
.pb-step:not(.is-active):not(.is-done) .pb-step-num {
  background: #fff;
  color: var(--pb-text-soft);
}

.pb-step-label { font-weight: 600; }

/* =======================================================================
   LAYOUT GÉNÉRAL
   ======================================================================= */

.pb-booking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .pb-booking-layout { grid-template-columns: 1fr; }
}

.pb-booking-main { min-width: 0; }

/* =======================================================================
   PANELS
   ======================================================================= */

.pb-panel {
  background: var(--pb-bg);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--pb-shadow-sm);
}

@media (max-width: 640px) {
  .pb-panel { padding: 16px 12px; border-radius: 14px; }
  .pb-booking { padding: 16px 8px; }
}

.pb-panel-head { margin-bottom: 20px; }
.pb-panel-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--pb-text);
}
.pb-panel-head p {
  margin: 0;
  color: var(--pb-text-soft);
  font-size: 14px;
}

.pb-muted { color: var(--pb-text-soft); font-size: 14px; }

/* =======================================================================
   CALENDRIER
   ======================================================================= */

.pb-calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.pb-calendar-nav-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--pb-text);
  letter-spacing: -0.01em;
}

.pb-nav-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--pb-border);
  background: #fff;
  color: var(--pb-text);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.pb-nav-btn:hover {
  background: var(--pb-text);
  border-color: var(--pb-text);
  color: #fff;
}

.pb-calendar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  min-width: 0;
  overflow: hidden;
}

.pb-cal-month {
  min-width: 0;
  width: 100%;
}

.pb-cal-month-title {
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  color: var(--pb-text);
  margin-bottom: 12px;
}

.pb-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--pb-text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: center;
}
.pb-cal-weekdays > div {
  padding: 8px 0;
}

/* Grille avec gap nul horizontal pour permettre l'effet "pillule" */
.pb-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 4px;
  column-gap: 0;
}

.pb-cal-day {
  aspect-ratio: auto !important;
  height: 56px !important;
  border: none !important;
  background: transparent !important;
  border-radius: 8px !important;
  padding: 4px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 1px !important;
  font-family: inherit !important;
  color: var(--pb-text) !important;
  cursor: pointer !important;
  transition: background-color .12s ease, color .12s ease !important;
  line-height: 1 !important;
  position: relative !important;
  box-shadow: none !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  min-width: 0 !important;
  width: 100% !important;
  outline: none !important;
}

.pb-cal-day:hover:not(.pb-cal-day--disabled):not(.pb-cal-day--empty):not(.pb-cal-day--start):not(.pb-cal-day--end):not(.pb-cal-day--in-range) {
  background: var(--pb-bg-soft) !important;
}

.pb-cal-day-num {
  font-size: 14px !important;
  font-weight: 500 !important;
  letter-spacing: -0.01em !important;
}
.pb-cal-day-price {
  font-size: 10px !important;
  color: var(--pb-text-light) !important;
  font-weight: 500 !important;
  margin-top: 2px !important;
}

.pb-cal-day--empty {
  background: transparent !important;
  cursor: default !important;
  pointer-events: none !important;
}

.pb-cal-day--disabled {
  color: var(--pb-text-light) !important;
  cursor: not-allowed !important;
  opacity: 0.4 !important;
}
.pb-cal-day--disabled .pb-cal-day-num {
  text-decoration: line-through !important;
}
.pb-cal-day--disabled .pb-cal-day-price { display: none !important; }

.pb-cal-day--no-arrival {
  opacity: 0.75 !important;
}

/* ===== PIVOT MATIN/SOIR ============================================
 * Split diagonal : haut-gauche = matin, bas-droite = soir
 * - checkin-pivot : jour bloqué où qqn arrive le soir
 *   → matin libre (haut-gauche) / soir bloqué (bas-droite)
 * - checkout-pivot : jour où qqn part le matin (= jour disponible pour nouvelle arrivée)
 *   → matin bloqué (haut-gauche) / soir libre (bas-droite)
 */
/* ===== PIVOT MATIN/SOIR ============================================
 * Split diagonal : haut-gauche = matin, bas-droite = soir
 * - checkin-pivot : jour bloqué où qqn arrive le soir
 *   → matin libre (haut-gauche) / soir bloqué (bas-droite)
 *   → cliquable UNIQUEMENT comme jour de départ
 * - checkout-pivot : jour où qqn part le matin (= jour disponible pour nouvelle arrivée)
 *   → matin bloqué (haut-gauche) / soir libre (bas-droite)
 */
.pb-cal-day--checkin-pivot {
  background: linear-gradient(135deg, #fafafa 49.5%, rgba(209, 213, 219, 0.55) 50.5%) !important;
  opacity: 1 !important;
  color: var(--pb-text) !important;
  cursor: pointer;
  position: relative;
}
.pb-cal-day--checkin-pivot .pb-cal-day-num {
  text-decoration: none !important;
  font-weight: 600;
  color: var(--pb-text) !important;
}
.pb-cal-day--checkin-pivot .pb-cal-day-price {
  opacity: 0.5;
}
/* Quand une arrivée est déjà sélectionnée, le checkin-pivot devient "survolable"
 * pour signaler qu'on peut l'utiliser comme départ */
.pb-cal-day--checkin-pivot:hover:not(.pb-cal-day--start):not(.pb-cal-day--end) {
  background: linear-gradient(135deg, var(--pb-accent-soft) 49.5%, rgba(209, 213, 219, 0.55) 50.5%) !important;
}

.pb-cal-day--checkout-pivot {
  background: linear-gradient(135deg, rgba(209, 213, 219, 0.55) 49.5%, transparent 50.5%) !important;
  position: relative;
}
.pb-cal-day--checkout-pivot:hover:not(.pb-cal-day--start):not(.pb-cal-day--end):not(.pb-cal-day--in-range) {
  background: linear-gradient(135deg, rgba(209, 213, 219, 0.55) 49.5%, var(--pb-accent-soft) 50.5%) !important;
}

/* ============ EFFET PILLULE CONTINUE ============ */

.pb-cal-day--in-range {
  background: var(--pb-accent-soft) !important;
  color: var(--pb-accent) !important;
  border-radius: 0 !important;
}

.pb-cal-day--start {
  background: var(--pb-accent) !important;
  color: #fff !important;
  border-radius: 8px 0 0 8px !important;
  position: relative !important;
  z-index: 2 !important;
}

.pb-cal-day--end {
  background: var(--pb-accent) !important;
  color: #fff !important;
  border-radius: 0 8px 8px 0 !important;
  position: relative !important;
  z-index: 2 !important;
}

.pb-cal-day--start.pb-cal-day--end {
  border-radius: 8px !important;
}

.pb-cal-day--start .pb-cal-day-num,
.pb-cal-day--end .pb-cal-day-num {
  font-weight: 700 !important;
  color: #fff !important;
}
.pb-cal-day--in-range .pb-cal-day-num {
  font-weight: 600 !important;
  color: var(--pb-accent) !important;
}
.pb-cal-day--start .pb-cal-day-price,
.pb-cal-day--end .pb-cal-day-price {
  color: rgba(255, 255, 255, 0.85) !important;
}

.pb-calendar-message { margin-top: 14px; }

/* Mobile : ajustements */
@media (max-width: 640px) {
  .pb-cal-day { height: 44px !important; padding: 2px !important; }
  .pb-cal-day-num { font-size: 13px !important; }
  .pb-cal-day-price { font-size: 9px !important; }
  .pb-calendar-nav-title { font-size: 15px; }
  .pb-nav-btn { width: 32px; height: 32px; font-size: 14px; }
}

/* =======================================================================
   EXTRAS
   ======================================================================= */

.pb-extras-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.pb-extra-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-sm);
  background: #fff;
  transition: all .15s ease;
}
.pb-extra-card:hover {
  border-color: var(--pb-accent);
  box-shadow: var(--pb-shadow-sm);
}

@media (max-width: 640px) {
  .pb-extra-card { grid-template-columns: 1fr; }
  .pb-extra-thumb { aspect-ratio: 16 / 9; }
}

.pb-extra-thumb {
  border-radius: 10px;
  overflow: hidden;
  background: var(--pb-bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
}
.pb-extra-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.pb-extra-thumb--placeholder {
  color: var(--pb-text-light);
  font-size: 28px;
}

.pb-extra-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.pb-extra-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.pb-extra-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--pb-text);
}
.pb-extra-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--pb-text-soft);
  line-height: 1.4;
}

.pb-extra-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.pb-extra-badge--auto    { background: #d1fae5; color: #065f46; }
.pb-extra-badge--manual  { background: #fde68a; color: #92400e; }
.pb-extra-badge--request { background: #dbeafe; color: #1e40af; }

.pb-extra-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 10px;
}

.pb-extra-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--pb-accent);
}

.pb-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--pb-border);
  border-radius: 999px;
  overflow: hidden;
}
.pb-qty-btn {
  width: 36px; height: 36px;
  border: none;
  background: #fff;
  color: var(--pb-text);
  font-size: 18px;
  cursor: pointer;
  transition: background .15s ease;
}
.pb-qty-btn:hover { background: var(--pb-accent-soft); color: var(--pb-accent); }
.pb-qty-val {
  min-width: 34px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}

/* =======================================================================
   FORMULAIRE
   ======================================================================= */

.pb-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 640px) {
  .pb-form-grid { grid-template-columns: 1fr; }
}

.pb-field { display: flex; flex-direction: column; gap: 6px; }
.pb-field-full { grid-column: 1 / -1; }

.pb-field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--pb-text);
}

.pb-field input,
.pb-field select,
.pb-field textarea {
  padding: 10px 14px;
  border: 1px solid var(--pb-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--pb-text);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.pb-field input:focus,
.pb-field select:focus,
.pb-field textarea:focus {
  outline: none;
  border-color: var(--pb-accent);
  box-shadow: 0 0 0 3px rgba(166, 30, 34, 0.1);
}

.pb-field input.pb-invalid,
.pb-field select.pb-invalid,
.pb-field textarea.pb-invalid {
  border-color: var(--pb-danger);
  background: #fef2f2;
}

.pb-capacity-hint {
  padding: 10px 14px;
  background: var(--pb-bg-soft);
  border-radius: 8px;
  font-size: 13px;
  color: var(--pb-text-soft);
  margin-top: -4px;
}
.pb-capacity-hint--over {
  background: #fef2f2;
  color: var(--pb-danger);
  border: 1px solid #fecaca;
}

.pb-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--pb-bg-soft);
  border-radius: 12px;
  font-size: 13px;
  color: var(--pb-text-soft);
  line-height: 1.4;
  cursor: pointer;
}
.pb-consent input { margin-top: 2px; flex-shrink: 0; }
.pb-consent a { color: var(--pb-accent); font-weight: 600; }

/* =======================================================================
   PAIEMENT
   ======================================================================= */

.pb-payment-box {
  text-align: center;
  padding: 40px 20px;
}

.pb-payment-reassurance {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--pb-text-soft);
}

/* =======================================================================
   NAVIGATION FOOTER
   ======================================================================= */

.pb-nav-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.pb-btn {
  padding: 14px 32px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  border: 1px solid transparent;
  letter-spacing: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-shadow: none;
}
.pb-btn-primary {
  background: var(--pb-accent) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(166, 30, 34, 0.20) !important;
  font-weight: 700 !important;
  border: 1px solid var(--pb-accent) !important;
}
.pb-btn-primary:hover,
.pb-btn-primary:focus {
  background: var(--pb-accent-dark) !important;
  border-color: var(--pb-accent-dark) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(166, 30, 34, 0.28) !important;
}
.pb-btn-primary:active {
  transform: translateY(0);
}
.pb-btn-ghost {
  background: #ffffff;
  border-color: var(--pb-border);
  color: var(--pb-text);
  font-weight: 600;
}
.pb-btn-ghost:hover {
  background: var(--pb-bg-soft);
  border-color: var(--pb-text-soft);
  color: var(--pb-text);
}

/* =======================================================================
   COLONNE RÉCAP (summary)
   ======================================================================= */

.pb-booking-summary {
  position: sticky;
  top: 24px;
}

.pb-summary-card {
  background: #fff;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius);
  padding: 24px;
  box-shadow: var(--pb-shadow);
}

.pb-summary-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--pb-text);
}

.pb-summary-logement {
  margin: -24px -24px 20px;
  border-radius: var(--pb-radius) var(--pb-radius) 0 0;
  overflow: hidden;
  background: var(--pb-bg-soft);
}
.pb-summary-logement-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.pb-summary-logement-name {
  padding: 12px 24px 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--pb-text);
}
.pb-summary-logement-addr {
  padding: 0 24px 12px;
  font-size: 12px;
  color: var(--pb-text-soft);
  line-height: 1.3;
}

.pb-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  color: var(--pb-text-soft);
}
.pb-summary-row strong {
  color: var(--pb-text);
  font-weight: 600;
}

.pb-summary-empty {
  padding: 16px 0;
  font-size: 14px;
  color: var(--pb-text-soft);
  text-align: center;
  border-top: 1px dashed var(--pb-border);
  margin-top: 10px;
}

.pb-summary-extra-row {
  font-size: 13px;
}

.pb-summary-card hr {
  border: 0;
  border-top: 1px solid var(--pb-border);
  margin: 12px 0;
}

.pb-summary-total { font-size: 16px; }
.pb-summary-total strong { font-size: 18px; color: var(--pb-accent); }

.pb-summary-deposit {
  margin-top: 8px;
  padding: 12px;
  background: var(--pb-accent-soft);
  border-radius: 12px;
}
.pb-summary-deposit strong { color: var(--pb-accent); font-size: 16px; }

.pb-summary-balance {
  font-size: 13px;
  color: var(--pb-text-soft);
}

.pb-trust {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--pb-border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-size: 11px;
  color: var(--pb-text-light);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.pb-trust > div {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* =======================================================================
   LOADING / ERREUR
   ======================================================================= */

.pb-booking [hidden],
.pb-thankyou [hidden] {
  display: none !important;
}

.pb-loading {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 9999;
}

.pb-loading-spin {
  width: 48px; height: 48px;
  border: 4px solid var(--pb-border);
  border-top-color: var(--pb-accent);
  border-radius: 50%;
  animation: pb-spin 0.8s linear infinite;
}
@keyframes pb-spin { to { transform: rotate(360deg); } }

.pb-error-banner {
  margin-top: 20px;
  padding: 14px 18px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--pb-danger);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
}

/* =======================================================================
   PAGE DE REMERCIEMENT
   ======================================================================= */

.pb-thankyou {
  max-width: 640px;
  margin: 40px auto;
  padding: 40px 32px;
  background: #fff;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius);
  box-shadow: var(--pb-shadow);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--pb-text);
  text-align: center;
}
.pb-thankyou h2 {
  color: var(--pb-accent);
  font-size: 28px;
  margin: 0 0 16px;
}
.pb-thankyou p { color: var(--pb-text-soft); line-height: 1.5; }
.pb-thankyou-card {
  margin: 28px 0;
  padding: 24px;
  background: var(--pb-bg-soft);
  border-radius: 12px;
  text-align: left;
}
.pb-thankyou--cancel h2 { color: var(--pb-warning); }
