/* layout.css — Structure générale : header, contenu, tab bar, modale */

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  /* 100dvh = hauteur réellement visible sur iOS, barre d'adresse comprise.
     La ligne 100vh sert de repli pour les navigateurs antérieurs à iOS 15.4. */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ─── Header ─── */
.app-header {
  /* La hauteur totale inclut la zone sous l'encoche ; le padding-top
     repousse le contenu réel sous la barre de statut iOS.
     box-sizing: border-box (défini globalement) fait que
     .app-header__inner occupe bien var(--header-height). */
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  z-index: 100;
}
.app-header__inner {
  height: 100%;
  padding: 0 var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header__title { font-size: var(--text-lg); font-weight: 800; letter-spacing: -0.02em; }

/* ─── Réseau ─── */
.network-status { display: flex; align-items: center; gap: var(--space-2); }
.network-status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-success); transition: background var(--transition-normal); }
.network-status__dot--offline { background: var(--color-error); }
.network-status__dot--weak    { background: var(--color-warning); }
.network-status__label { font-size: var(--text-xs); color: var(--color-text-secondary); }

/* ─── Contenu principal ─── */
.app-content { flex: 1; position: relative; overflow: hidden; min-height: 0; }

/* ─── Panneaux d'onglets ─── */
.tab-panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  pointer-events: none;
  transform: translateX(20px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}
.tab-panel--active { opacity: 1; pointer-events: auto; transform: translateX(0); }

/* ─── Tab bar ─── */
.tab-bar {
  height: var(--tab-bar-height);
  padding-bottom: 0;
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  z-index: 100;
}
.tab-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-2) var(--space-3);
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
  position: relative;
}
.tab-bar__item:active { background: var(--color-bg-elevated); }
.tab-bar__item--active { color: var(--color-accent); }
.tab-bar__icon { width: 24px; height: 24px; flex-shrink: 0; }
.tab-bar__label { font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.tab-bar__badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 20px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--color-accent);
  color: var(--color-bg-primary);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── FAB ─── */
.fab {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  z-index: 10;
}
.fab:active { transform: scale(0.93); background: var(--color-bg-elevated); }
.fab--locate { bottom: var(--space-5); right: var(--space-5); }

/* ─── Modale POI ─── */
.poi-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-4);
  /* PAS de display: flex ici — la dialog est display: none par défaut
     quand elle n'a pas l'attribut open */
}
.poi-modal[open] {
  display: flex;
}
.poi-modal__content {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-bottom: none;
  padding-bottom: calc(var(--space-8) + var(--safe-area-bottom));
  animation: sheet-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes sheet-in { from{transform:translateY(30px);opacity:0} to{transform:translateY(0);opacity:1} }
.poi-modal__header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-bg-secondary);
  padding: var(--space-4) var(--space-5) var(--space-3);
  display: flex;
  justify-content: flex-end;
}
.poi-modal__close { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; color: var(--color-text-secondary); border-radius: 50%; transition: all var(--transition-fast); }
.poi-modal__close:active { background: var(--color-bg-elevated); }
.poi-modal__image-wrapper { width: 100%; aspect-ratio: 16/9; overflow: hidden; }
.poi-modal__image { width: 100%; height: 100%; object-fit: cover; }
.poi-modal__body { padding: var(--space-5) var(--space-6); }
.poi-modal__title {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-3);
  color: var(--color-text-primary);
}
.poi-modal__distance { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-accent); margin-bottom: var(--space-4); }
.poi-modal__description { font-size: var(--text-base); line-height: 1.7; color: var(--color-text-secondary); }
.poi-modal__actions { padding: var(--space-4) var(--space-6); display: flex; gap: var(--space-3); align-items: center; }
.poi-modal__audio-meta { padding: 0 var(--space-6) var(--space-4); display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted); }
