:root {
  --background: #FAF7F2;
  --surface: #FFFFFF;
  --surface-alt: #F1ECE3;
  --primary: #F2740A;
  --primary-dark: #C25A05;
  --secondary: #0E8A34;
  --ink: #1C1B19;
  --ink-soft: #6B6560;
  --border: #E8E1D8;
  --success: #0E8A34;
  --warning: #B8860B;
  --error: #B3261E;
  --whatsapp: #25D366;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--background);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }
img { max-width: 100%; display: block; }

.container { max-width: 480px; margin: 0 auto; }
@media (min-width: 900px) {
  .container { max-width: 720px; }
}

/* ==================== EN-TÊTE ==================== */

.hero-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 20px 20px 28px;
  border-radius: 0 0 28px 28px;
}

.hero-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: white; }
.brand img { width: 28px; height: 28px; }

.hero-title {
  color: white;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.8px;
  line-height: 1.15;
  margin-bottom: 18px;
}

.search-row { display: flex; gap: 10px; }

.search-pill {
  flex: 1;
  background: white;
  border-radius: 30px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border: none;
}

.search-pill svg { width: 16px; height: 16px; fill: var(--primary); flex-shrink: 0; }

/* ==================== CARTES RÉSIDENCE ==================== */

.residence-grid {
  padding: 20px 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 640px) {
  .residence-grid { grid-template-columns: 1fr 1fr; }
}

.residence-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: var(--surface-alt);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.residence-card img {
  width: 100%; height: 100%; object-fit: cover;
}

.residence-card .scrim {
  position: absolute; left: 0; right: 0; bottom: 0; top: 45%;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.75));
}

.residence-card .badge {
  position: absolute; top: 14px; left: 14px;
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  display: flex; align-items: center; gap: 4px;
}

.residence-card .badge.boosted { background: var(--secondary); color: white; }

.residence-card .info {
  position: absolute; left: 16px; right: 16px; bottom: 14px;
  color: white;
}

.residence-card .info h3 { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.residence-card .info .location { font-size: 12px; color: rgba(255,255,255,0.85); margin-bottom: 8px; }
.residence-card .info .price { font-size: 15px; font-weight: 700; }
.residence-card .info .price small { font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.75); }

.fallback-banner {
  margin: 0 16px 4px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: 8px;
}

.empty-state, .loading-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--ink-soft);
  font-size: 14px;
}

/* ==================== DÉTAIL RÉSIDENCE ==================== */

.detail-gallery {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-alt);
  overflow: hidden;
}

.detail-gallery img, .detail-gallery video {
  width: 100%; height: 100%; object-fit: cover;
}

.detail-back {
  position: absolute; top: 16px; left: 16px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.detail-body { padding: 24px 20px 100px; }

.detail-price-row {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px;
}
.detail-price-row .price-main { font-size: 28px; font-weight: 800; color: var(--primary); }
.detail-price-row .price-unit { font-size: 13px; color: var(--ink-soft); }
.detail-price-row .rating { margin-left: auto; display: flex; align-items: center; gap: 4px; font-weight: 700; }

.detail-price-secondary { font-size: 14px; font-weight: 600; color: var(--secondary); margin-bottom: 16px; }

.detail-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.detail-location { font-size: 14px; color: var(--ink-soft); margin-bottom: 20px; }

.detail-specs {
  display: flex; gap: 20px; padding: 16px 0; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border); margin-bottom: 20px; font-size: 13px;
}
.detail-specs .spec { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); }

.detail-section { margin-bottom: 24px; }
.detail-section h2 { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.detail-section p { font-size: 14px; color: var(--ink-soft); line-height: 1.6; }

.amenities-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.amenity { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.amenity svg { width: 16px; height: 16px; fill: var(--primary); flex-shrink: 0; }

.warning-box {
  display: flex; gap: 10px; padding: 14px;
  background: rgba(179,38,30,0.08); border: 1px solid rgba(179,38,30,0.25);
  border-radius: 14px; margin-bottom: 20px;
}
.warning-box svg { width: 20px; height: 20px; fill: var(--error); flex-shrink: 0; }
.warning-box p { font-size: 12.5px; color: var(--ink); line-height: 1.4; }

.contact-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 20px; margin-bottom: 20px;
}
.contact-section h2 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.contact-buttons { display: flex; gap: 10px; }
.btn-contact {
  flex: 1; padding: 13px; border-radius: 12px; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-whatsapp { background: var(--whatsapp); color: white; }
.btn-call { background: transparent; border: 1px solid var(--border); color: var(--ink); }

.detail-sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  z-index: 50;
}
.detail-sticky-bar .inner {
  max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
}
@media (min-width: 900px) { .detail-sticky-bar .inner { max-width: 720px; } }

.btn-primary {
  padding: 14px 24px; border-radius: 12px; background: var(--primary); color: white;
  font-size: 15px; font-weight: 700; white-space: nowrap;
}
.btn-primary:disabled { opacity: 0.5; }

/* ==================== FORMULAIRE DE RÉSERVATION (modale) ==================== */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100;
}
@media (min-width: 640px) { .modal-overlay { align-items: center; } }

.modal-sheet {
  background: var(--surface);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px 32px;
}
@media (min-width: 640px) { .modal-sheet { border-radius: 24px; } }

.modal-sheet h2 { font-size: 19px; font-weight: 800; margin-bottom: 16px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px;
}
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

.tariff-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.tariff-option {
  flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: 12px; text-align: center;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.tariff-option.selected { border-color: var(--primary); border-width: 2px; background: rgba(242,116,10,0.06); color: var(--primary); }

.guest-notice {
  display: flex; gap: 8px; padding: 12px; background: var(--surface-alt); border-radius: 12px;
  font-size: 12px; color: var(--ink-soft); margin-bottom: 16px;
}

.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-alt); font-size: 18px; color: var(--ink-soft);
}

.confirmation-box { text-align: center; padding: 20px 0; }
.confirmation-box .check-icon {
  width: 64px; height: 64px; border-radius: 50%; background: rgba(14,138,52,0.1);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.confirmation-box .check-icon svg { width: 32px; height: 32px; fill: var(--success); }
.confirmation-code {
  background: var(--surface-alt); border-radius: 12px; padding: 14px; margin: 16px 0;
  font-size: 18px; font-weight: 800; letter-spacing: 1px;
}

.toast-container { position: fixed; bottom: 90px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none; }
.toast { background: var(--ink); color: white; padding: 12px 18px; border-radius: 12px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.toast.error { background: var(--error); }
