/* ─────────────────────────────────────────────────────────
   Hospitable Booking – CSS principal (mobile-first)
   ───────────────────────────────────────────────────────── */

:root {
  --hb-primary: #2563eb;
  --hb-primary-dk: #1d4ed8;
  --hb-whatsapp: #25d366;
  --hb-whatsapp-dk: #128c7e;
  --hb-text: #1f2937;
  --hb-text-light: #6b7280;
  --hb-bg: #ffffff;
  --hb-bg-light: #f9fafb;
  --hb-border: #e5e7eb;
  --hb-radius: 12px;
  --hb-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --hb-error: #ef4444;
}

/* ── Grille (mobile: 1 col) ────────────────────────────── */

.hb-listings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 24px 0;
}

/* Tablette: 2 colonnes */
@media (min-width: 600px) {
  .hb-listings-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 32px 0;
  }
}

/* Desktop: colonnes selon attribut */
@media (min-width: 1024px) {
  .hb-listings-grid {
    gap: 24px;
  }
  .hb-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .hb-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ── Carte ──────────────────────────────────────────────── */

.hb-listing-card {
  background: var(--hb-bg);
  border: 1px solid var(--hb-border);
  border-radius: var(--hb-radius);
  overflow: hidden;
  box-shadow: var(--hb-shadow);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

/* Hover uniquement desktop (pas de hover fantôme sur mobile) */
@media (hover: hover) {
  .hb-listing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  }
  .hb-listing-card:hover .hb-listing-image img {
    transform: scale(1.04);
  }
}

.hb-listing-image {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
}

.hb-listing-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.hb-listing-info {
  padding: 16px;
}

@media (min-width: 600px) {
  .hb-listing-info {
    padding: 20px;
  }
}

.hb-listing-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--hb-text);
  margin: 0 0 6px;
  line-height: 1.3;
}

@media (min-width: 600px) {
  .hb-listing-name {
    font-size: 1.15rem;
    margin: 0 0 8px;
  }
}

.hb-listing-location {
  font-size: 0.875rem;
  color: var(--hb-text-light);
  margin: 0 0 6px;
}

.hb-listing-details {
  font-size: 0.875rem;
  color: var(--hb-text-light);
  margin: 0 0 14px;
}

/* ── Boutons (touch-friendly : min 48px) ───────────────── */

.hb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  min-height: 48px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.2s ease,
    transform 0.1s ease;
}

.hb-btn:active {
  transform: scale(0.97);
}

.hb-btn-primary {
  background: var(--hb-primary);
  color: #fff !important;
  width: 100%;
}

@media (min-width: 600px) {
  .hb-btn-primary {
    width: auto;
  }
}

.hb-btn-primary:hover {
  background: var(--hb-primary-dk);
  color: #fff !important;
}

.hb-btn-whatsapp {
  background: var(--hb-whatsapp);
  color: #fff !important;
  font-size: 1rem;
  padding: 16px 28px;
  min-height: 52px;
  width: 100%;
  margin-top: 16px;
}

.hb-btn-whatsapp:hover {
  background: var(--hb-whatsapp-dk);
  color: #fff !important;
}

.hb-btn-whatsapp.hb-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Formulaire ────────────────────────────────────────── */

.hb-booking-form {
  background: var(--hb-bg-light);
  border: 1px solid var(--hb-border);
  border-radius: var(--hb-radius);
  padding: 20px;
  margin: 24px auto;
}

@media (min-width: 600px) {
  .hb-booking-form {
    padding: 32px;
    max-width: 600px;
    margin: 32px auto;
  }
}

.hb-form-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--hb-text);
  margin: 0 0 20px;
}

@media (min-width: 600px) {
  .hb-form-title {
    font-size: 1.5rem;
    margin: 0 0 24px;
  }
}

/* ── Calendrier inputs ─────────────────────────────────── */

.hb-calendar-wrapper {
  margin-bottom: 20px;
}

.hb-calendar-inputs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 480px) {
  .hb-calendar-inputs {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

.hb-input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hb-text);
  margin-bottom: 6px;
}

.hb-datepicker {
  width: 100%;
  padding: 12px 14px;
  min-height: 48px;
  border: 1.5px solid var(--hb-border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--hb-bg);
  color: var(--hb-text);
  cursor: pointer;
  box-sizing: border-box;
  -webkit-appearance: none;
  transition: border-color 0.2s;
}

.hb-datepicker:focus {
  outline: none;
  border-color: var(--hb-primary);
}

/* ── Voyageurs ─────────────────────────────────────────── */

.hb-guests-row {
  margin-bottom: 20px;
}

.hb-guests-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hb-text);
  margin-bottom: 6px;
}

.hb-guests-input {
  width: 100%;
  max-width: 120px;
  padding: 12px 14px;
  min-height: 48px;
  border: 1.5px solid var(--hb-border);
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
  -webkit-appearance: none;
}

.hb-guests-input:focus {
  outline: none;
  border-color: var(--hb-primary);
}

/* ── Avis mini (sous chaque fiche logement) ────────────── */

.hb-reviews-mini {
  margin: 12px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hb-review-mini {
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 8px;
  border-left: 3px solid #c5a55a;
}

.hb-review-mini__stars {
  font-size: 0.6875rem;
  color: #c5a55a;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.hb-review-mini__text {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--hb-text);
  margin: 0 0 4px;
  font-style: italic;
}

.hb-review-mini__meta {
  font-size: 0.6875rem;
  color: var(--hb-text-light);
}

/* ── Prix ──────────────────────────────────────────────── */

.hb-price-result {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--hb-primary);
  min-height: 28px;
  margin: 8px 0;
}

.hb-hint {
  font-size: 0.8125rem;
  color: var(--hb-text-light);
  margin: 8px 0 0;
}

/* ── Messages ──────────────────────────────────────────── */

.hb-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 16px;
  color: var(--hb-error);
  font-size: 0.9375rem;
}

.hb-no-listings {
  text-align: center;
  color: var(--hb-text-light);
  padding: 40px 20px;
}

/* ── Flatpickr surcharges ──────────────────────────────── */

.flatpickr-day.flatpickr-disabled {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  text-decoration: line-through;
  cursor: not-allowed;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--hb-primary) !important;
  border-color: var(--hb-primary) !important;
}

.flatpickr-day.inRange {
  background: rgba(37, 99, 235, 0.15) !important;
  border-color: transparent !important;
}

/* Flatpickr mobile : plus grand pour le touch */
@media (max-width: 480px) {
  .flatpickr-calendar {
    width: calc(100vw - 32px) !important;
    left: 16px !important;
    right: 16px !important;
  }
  .flatpickr-day {
    height: 42px !important;
    line-height: 42px !important;
  }
}

/* ══════════════════════════════════════════════════════════
   Barre de recherche style Airbnb (mobile-first)
   ══════════════════════════════════════════════════════════ */

.hb-search {
  margin: 0 0 32px;
}

/* ── Barre ─────────────────────────────────────────────── */

.hb-search__bar {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--hb-bg);
  border: 1px solid var(--hb-border);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

@media (min-width: 768px) {
  .hb-search__bar {
    flex-direction: row;
    align-items: stretch;
    border-radius: 60px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  }
}

/* ── Champ ─────────────────────────────────────────────── */

.hb-search__field {
  flex: 1;
  padding: 16px 20px;
  position: relative;
}

@media (min-width: 768px) {
  .hb-search__field {
    padding: 14px 24px;
  }
}

.hb-search__field label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hb-text);
  margin-bottom: 4px;
}

.hb-search__input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.9375rem;
  color: var(--hb-text);
  font-family: inherit;
  padding: 0;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
}

.hb-search__input::placeholder {
  color: var(--hb-text-light);
}

/* ── Séparateur ────────────────────────────────────────── */

.hb-search__sep {
  height: 1px;
  background: var(--hb-border);
  margin: 0 20px;
}

@media (min-width: 768px) {
  .hb-search__sep {
    width: 1px;
    height: auto;
    margin: 12px 0;
    align-self: stretch;
  }
}

/* ── Stepper voyageurs ─────────────────────────────────── */

.hb-search__stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hb-search__stepper-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--hb-border);
  background: var(--hb-bg);
  font-size: 1.125rem;
  color: var(--hb-text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.2s,
    background 0.2s;
  padding: 0;
  line-height: 1;
}

.hb-search__stepper-btn:hover {
  border-color: var(--hb-text);
}

.hb-search__stepper-btn:active {
  background: var(--hb-bg-light);
}

.hb-search__input--guests {
  width: 32px;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  cursor: default;
}

.hb-search__field--guests {
  flex: 0 0 auto;
}

/* ── Bouton rechercher ─────────────────────────────────── */

.hb-search__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--hb-primary);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 16px 24px;
  min-height: 52px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.2s,
    opacity 0.2s;
}

@media (min-width: 768px) {
  .hb-search__btn {
    border-radius: 60px;
    margin: 8px;
    padding: 14px 28px;
    min-height: auto;
  }
}

.hb-search__btn:hover {
  background: var(--hb-primary-dk);
}

.hb-search__btn:disabled,
.hb-search__btn.is-loading {
  opacity: 0.7;
  cursor: wait;
}

.hb-search__btn svg {
  flex-shrink: 0;
}

/* ── Messages statut ───────────────────────────────────── */

.hb-search__status {
  margin-top: 24px;
}

.hb-search__msg {
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.hb-search__msg--loading {
  background: #eff6ff;
  color: var(--hb-primary);
  text-align: center;
}

@keyframes hbPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.hb-search__msg--loading::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--hb-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: hbSpin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes hbSpin {
  to {
    transform: rotate(360deg);
  }
}

.hb-search__msg--ok {
  background: #f0fdf4;
  color: #166534;
  font-weight: 600;
  text-align: center;
}

.hb-search__msg--warn {
  background: #fff7ed;
  color: #9a3412;
  text-align: center;
}

.hb-search__msg--empty {
  background: var(--hb-bg-light);
  color: var(--hb-text-light);
  text-align: center;
  padding: 32px 20px;
}

/* ── Résultats : cartes avec prix ──────────────────────── */

.hb-search__results {
  margin-top: 24px;
}

.hb-search__price {
  margin: 12px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hb-search__price-night {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--hb-text);
}

.hb-search__price-night small {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--hb-text-light);
}

.hb-search__price-total {
  font-size: 0.8125rem;
  color: var(--hb-text-light);
}

/* Prix total EUR + DZD — même taille, même couleur dorée */
.hb-search__price-total-main {
  font-size: 1.125rem;
  font-weight: 700;
  color: #c9a96e;
  letter-spacing: -0.02em;
}

/* Bouton doré (remplace hb-btn-primary bleu) */
.hb-btn-gold {
  background: #c9a96e;
  color: #fff !important;
  width: 100%;
}

@media (min-width: 600px) {
  .hb-btn-gold { width: auto; }
}

.hb-btn-gold:hover {
  background: #b8953f;
  color: #fff !important;
}

/* Animation d'entrée des résultats */
.hb-search__card {
  animation: hbCardIn 0.4s ease both;
}

.hb-search__card:nth-child(1) {
  animation-delay: 0s;
}
.hb-search__card:nth-child(2) {
  animation-delay: 0.08s;
}
.hb-search__card:nth-child(3) {
  animation-delay: 0.16s;
}
.hb-search__card:nth-child(4) {
  animation-delay: 0.24s;
}
.hb-search__card:nth-child(5) {
  animation-delay: 0.32s;
}
.hb-search__card:nth-child(6) {
  animation-delay: 0.4s;
}

@keyframes hbCardIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hb-search__card {
    animation: none;
  }
}
