/* ============================================================
   park4night Premium — UI components
   Construit sur les tokens du design system (colors_and_type.css)
   Règles DS : fond blanc dominant, cartes à ombre bleutée douce,
   boutons pill bleus, gradient réservé aux CTA hero, divider mint
   dashed sous les titres de section, pas de glassmorphism.
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-2);
  color: var(--fg-1);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
}

#root { min-height: 100vh; }

/* ── Layout général ──────────────────────────────────────── */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-8) var(--space-8) var(--space-16);
  max-width: 1180px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .app-content { padding: var(--space-4) var(--space-4) var(--space-12); }
}

/* ── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-4);
  gap: var(--space-2);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__logo {
  padding: 0 var(--space-3) var(--space-6);
}

.sidebar__logo img { width: 100%; display: block; }

.sidebar__eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--fg-2);
  font-weight: var(--fw-medium);
  font-size: var(--text-sm);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 150ms ease, color 150ms ease;
}

.sidebar__link:hover { background: var(--bg-2); color: var(--fg-1); }

.sidebar__link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: var(--fw-bold);
}

.sidebar__link img { width: 20px; height: 20px; }

.sidebar__footer { margin-top: auto; }

/* Sidebar mobile */
.sidebar__overlay { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    z-index: 50;
    left: 0;
    transform: translateX(-100%);
    transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: none;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar__overlay.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(15, 27, 61, 0.4);
  }
}

/* ── Topbar ──────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.topbar__burger { display: none; }

@media (max-width: 900px) {
  .topbar__burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-1);
    background: var(--white);
    cursor: pointer;
  }
}

/* ── Titres de section + divider signature ──────────────── */

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}

.page-subtitle {
  color: var(--fg-3);
  font-size: var(--text-sm);
  margin: var(--space-1) 0 0;
}

.section-title {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--space-2);
}

/* Divider mint dashed — motif signature, à utiliser sous les titres */
.dashed-divider {
  width: 96px;
  border: none;
  border-top: 3px dashed var(--green-400);
  margin: 0 0 var(--space-5);
}

/* ── Cartes ──────────────────────────────────────────────── */

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

.card + .card { margin-top: var(--space-6); }

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

/* ── Boutons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, box-shadow 120ms ease, transform 100ms ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn:focus-visible { outline: 2px solid var(--p4n-blue); outline-offset: 3px; }

.btn--primary { background: var(--p4n-blue); color: var(--white); }
.btn--primary:hover { background: var(--blue-600); box-shadow: var(--shadow-md); }
.btn--primary:active { background: var(--blue-700); }

.btn--gradient { background: var(--p4n-gradient); color: var(--white); }
.btn--gradient:hover { box-shadow: var(--shadow-md); filter: brightness(0.96); }

.btn--secondary {
  background: var(--white);
  color: var(--p4n-blue);
  border-color: var(--border-1);
}
.btn--secondary:hover { background: var(--accent-soft); }

.btn--ghost { background: transparent; color: var(--p4n-blue); }
.btn--ghost:hover { background: var(--accent-soft); }

.btn--danger { background: var(--danger); color: var(--white); }
.btn--danger:hover { filter: brightness(0.92); }

.btn:disabled,
.btn.is-disabled {
  background: var(--ink-200);
  color: var(--ink-400);
  border-color: transparent;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn--sm { padding: 6px 14px; font-size: var(--text-xs); }
.btn--lg { padding: 14px 28px; font-size: var(--text-base); }
.btn--block { width: 100%; }

.btn__icon { width: 16px; height: 16px; }

/* ── Tags / pills ────────────────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-3);
  color: var(--fg-2);
}

.tag--blue { background: var(--blue-50); color: var(--p4n-blue); }
.tag--green { background: var(--green-50); color: var(--green-700); }
.tag--warm { background: #FEF3E0; color: #8F5A00; }
.tag--dark { background: var(--ink-900); color: var(--white); }
.tag--gradient { background: var(--p4n-gradient); color: var(--white); }

/* ── Formulaires ─────────────────────────────────────────── */

.field { margin-bottom: var(--space-5); }

.field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-2);
  color: var(--fg-1);
}

.field__hint {
  font-size: var(--text-xs);
  color: var(--fg-3);
  margin-top: var(--space-1);
}

.field__error {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: var(--space-1);
}

.input,
.textarea,
.select {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--fg-1);
  background: var(--white);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--p4n-blue);
  box-shadow: 0 0 0 3px var(--blue-100);
}

.input.is-invalid,
.textarea.is-invalid {
  border-color: var(--danger);
}

.textarea { min-height: 120px; resize: vertical; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

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

/* ── Note / étoiles ──────────────────────────────────────── */

.rating {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: var(--fw-bold);
}

.rating img { width: 16px; height: 16px; }

/* ── Avatar ──────────────────────────────────────────────── */

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  object-fit: cover;
  background: var(--bg-3);
  flex-shrink: 0;
}

.avatar--placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  background: var(--p4n-gradient);
  font-weight: var(--fw-bold);
  font-size: var(--text-sm);
  text-transform: uppercase;
}

/* ── Modal ───────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 27, 61, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-6);
  animation: modal-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Photos ──────────────────────────────────────────────── */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 520px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

.photo-grid__item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-3);
}

.photo-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-grid__add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-md);
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.photo-grid__add:hover { border-color: var(--p4n-blue); color: var(--p4n-blue); }

/* ── États vides / chargement ────────────────────────────── */

.empty-state {
  text-align: center;
  color: var(--fg-3);
  padding: var(--space-12) var(--space-6);
  font-size: var(--text-sm);
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--blue-100);
  border-top-color: var(--p4n-blue);
  animation: spin 700ms linear infinite;
  margin: var(--space-10) auto;
}

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

/* ── Page de connexion (hero duotone) ────────────────────── */

/* Hauteur verrouillée au viewport : la page de connexion ne défile jamais.
   Si l'écran est très bas, c'est le panneau qui défile, pas la page. */
.login-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100dvh;
  overflow: hidden;
  background: var(--white);
}

.login-layout__panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(var(--space-6), 6vh, var(--space-12)) var(--space-10);
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}

.login-layout__logo {
  height: 40px;
  align-self: flex-start;
  margin-bottom: clamp(var(--space-6), 6vh, var(--space-12));
}

.login-layout__title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-lg), 2.6vw, var(--text-2xl));
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}

.login-layout__panel .field { margin-bottom: var(--space-4); }

.login-layout__hero {
  position: relative;
  overflow: hidden;
}

/* La photo est en portrait 1301x1948 : sans hauteur contrainte, elle
   imposerait sa taille intrinsèque et étirerait la grille. */
.login-layout__hero .p4n-duotone {
  display: block;
  width: 100%;
  height: 100%;
}

.login-layout__hero .p4n-duotone > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-layout__tagline {
  position: absolute;
  left: var(--space-10);
  bottom: var(--space-10);
  right: var(--space-10);
  color: var(--white);
  font-family: var(--font-display);
  font-size: clamp(var(--text-xl), 2.8vw, var(--text-3xl));
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  max-width: 420px;
}

@media (max-width: 900px) {
  .login-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  .login-layout__hero { display: none; }
  .login-layout__panel {
    padding: var(--space-8) var(--space-6);
    overflow-y: visible;
  }
}

/* ── Divers ──────────────────────────────────────────────── */

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--fw-black);
}

/* Texte tronqué sur une ligne (desktop) ; re-passe en multi-lignes en mobile */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* En-tête de section : titre + info/action à droite (plage de dates, lien…) */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  flex-wrap: wrap;
}

/* ── Tunnel de conversion ────────────────────────────────── */

.funnel-steps {
  display: flex;
  gap: var(--space-2);
}

.funnel-step {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.funnel-step__value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-black);
}

.funnel-arrow {
  align-self: center;
  color: var(--fg-3);
  font-size: var(--text-xl);
}

/* ── Responsive mobile ───────────────────────────────────── */

@media (max-width: 640px) {
  .card { padding: var(--space-4); }

  /* Le header de carte (titre + actions) passe sur deux lignes */
  .card__header { flex-wrap: wrap; }

  /* Les titres reprennent leur retour à la ligne plutôt que de tronquer */
  .truncate { white-space: normal; overflow: visible; }

  /* Le divider décoratif encombre les en-têtes étroits */
  .section-head .dashed-divider { display: none; }

  .funnel-steps { gap: var(--space-1); }
  .funnel-step__value { font-size: var(--text-xl); }
}

.flash {
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-5);
}

.flash--success { background: var(--green-50); color: var(--green-700); }
.flash--error { background: #FDECEC; color: var(--danger); }

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.text-muted { color: var(--fg-3); }
.text-sm { font-size: var(--text-sm); }

/* ── Page commentaires ───────────────────────────────────── */

.reviews-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-6);
  align-items: start;
}

.reviews-layout__filters {
  position: sticky;
  top: var(--space-6);
}

@media (max-width: 900px) {
  .reviews-layout { grid-template-columns: 1fr; }
  .reviews-layout__filters { position: static; }
}

/* ── Carte d'édition de localisation (MapLibre) ──────────── */

.location-map {
  width: 100%;
  height: 420px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-1);
}

@media (max-width: 520px) {
  .location-map { height: 320px; }
}

/* Recherche d'adresse (géocodage) au-dessus de la carte */
.geo-search {
  position: relative;
  margin-bottom: 12px;
}

.geo-search__results {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(15, 27, 61, 0.12));
}

.geo-search__item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border-1);
  background: none;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--fg-1, inherit);
  cursor: pointer;
}

.geo-search__item:last-child { border-bottom: 0; }
.geo-search__item:hover { background: var(--blue-50); }
