/*
 * main.css — Variables globales, reset, typographie
 * Audioguide Die / Trajet Spectacle
 * Thème sombre pour usage extérieur (OLED, lisibilité soleil)
 */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;800&display=swap');

/* ─── Variables ─── */
:root {
  --color-bg-primary:     #0f0f1a;
  --color-bg-secondary:   #1a1a2e;
  --color-bg-tertiary:    #252540;
  --color-bg-elevated:    #2e2e50;

  --color-accent:         #e8a045;
  --color-accent-muted:   rgba(232, 160, 69, 0.15);
  --color-accent-dim:     rgba(232, 160, 69, 0.4);

  --color-text-primary:   #f0ede8;
  --color-text-secondary: #9b98a3;
  --color-text-muted:     #5c5a6e;

  --color-success:        #5db87a;
  --color-warning:        #e8a045;
  --color-error:          #d96b5f;
  --color-info:           #7a9ed4;

  --color-border:         rgba(255, 255, 255, 0.08);
  --color-border-strong:  rgba(255, 255, 255, 0.15);

  --font-primary: 'Syne', system-ui, sans-serif;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;

  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);
  --shadow-accent: 0 0 20px rgba(232, 160, 69, 0.2);

  --transition-fast:   0.15s ease;
  --transition-normal: 0.25s ease;

  --header-height:    56px;
  --tab-bar-height:   72px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow: hidden; height: 100%; font-size: 16px; }

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  height: 100%;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.poi-modal__description, .poi-modal__title {
  -webkit-user-select: text;
  user-select: text;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

ol, ul { list-style: none; }

dialog {
  background: transparent;
  border: none;
  padding: 0;
  max-width: 100%;
  max-height: 100%;
}

dialog::backdrop {
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
}

img { max-width: 100%; height: auto; display: block; }

/* ─── Boutons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
  border: 1.5px solid transparent;
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-bg-primary);
  border-color: var(--color-accent);
}
.btn--primary:active { opacity: 0.85; transform: scale(0.97); }

.btn--accent { background: var(--color-accent); color: var(--color-bg-primary); }
.btn--ghost { background: transparent; border-color: var(--color-border-strong); color: var(--color-text-primary); }
.btn--ghost:active { background: var(--color-bg-elevated); }
.btn--large { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }
.btn--small { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }

/* ─── Progress bar ─── */
.progress-bar {
  width: 100%;
  height: 3px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* ─── Spinner ─── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Section title ─── */
.section-title {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
}

/* ─── Splash screen ─── */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--color-bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.splash-screen.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-screen__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-8);
  text-align: center;
}
.splash-screen__logo { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.7;transform:scale(.95)} }
.splash-screen__title { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -0.03em; }
.splash-screen__subtitle { font-size: var(--text-sm); color: var(--color-text-secondary); letter-spacing: .1em; text-transform: uppercase; }
.splash-screen__progress { width: 240px; margin-top: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); }
.splash-screen__progress-label { font-size: var(--text-xs); color: var(--color-text-muted); text-align: center; }

/* ─── Update banner ─── */
.update-banner {
  position: fixed;
  top: calc(var(--header-height) + env(safe-area-inset-top));
  left: var(--space-4);
  right: var(--space-4);
  z-index: 900;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-accent-dim);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  box-shadow: var(--shadow-lg);
}
.update-banner p { font-size: var(--text-sm); color: var(--color-text-secondary); }

/* ─── Empty state ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  color: var(--color-text-muted);
}
.empty-state svg { opacity: .4; }
.empty-state p { font-size: var(--text-base); font-weight: 600; }
.empty-state__sub { font-size: var(--text-sm) !important; font-weight: 400 !important; color: var(--color-text-muted); }

/* ─── Toast proximité ─── */
.proximity-toast {
  position: fixed;
  top: calc(var(--header-height) + env(safe-area-inset-top) + var(--space-4));
  left: var(--space-4);
  right: var(--space-4);
  z-index: 800;
  animation: slide-down 0.3s ease;
  filter: drop-shadow(0 4px 20px rgba(232, 160, 69, 0.3));
}
@keyframes slide-down { from{transform:translateY(-20px);opacity:0} to{transform:translateY(0);opacity:1} }
.proximity-toast__inner {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-accent-dim);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.proximity-toast__content { flex: 1; min-width: 0; }
.proximity-toast__content strong { display: block; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proximity-toast__content span { font-size: var(--text-xs); color: var(--color-text-secondary); }

/* DEV ONLY — neutralisation forcée de la bannière de mise à jour */
#update-banner { display: none !important; }

/* Garantit que l'attribut HTML hidden masque toujours,
   même si une règle plus spécifique définit display: flex/grid/etc. */
[hidden] { display: none !important; }
