/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *


 */

:root {
  --primary: #2d6a4f;
  --primary-dark: #1b4332;
  --accent: #e9c46a;
  --danger: #e76f51;
  --bg: #f7f5f0;
  --card: #ffffff;
  --text: #22303c;
  --muted: #6b7a86;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem 1rem;
  background: var(--primary-dark);
  color: #fff;
}
.topnav a, .topnav .linklike { color: #fff; text-decoration: none; font-weight: 500; }
.topnav .brand { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.brand-logo { width: 24px; height: 24px; }
.nav-links { display: flex; gap: 1rem; align-items: center; }
.linklike { background: none; border: none; padding: 0; font: inherit; cursor: pointer; }

.container { max-width: 720px; margin: 0 auto; padding: 1rem; }
.fullscreen { padding: 0; }

/* ---- Toasts : notifications flottantes, sans impact sur la mise en page ---- */
.toasts {
  position: fixed;
  top: max(.8rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: .8rem 1rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  animation: toast-in .3s ease-out;
  transition: opacity .3s, transform .3s;
}
.toast.notice { background: #d8f3dc; color: var(--primary-dark); }
.toast.alert { background: #ffe5d9; color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(-12px); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.a2a_kit { display: table; margin: .75rem auto 0; }

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius);
  padding: .7rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  background: var(--primary);
  color: #fff;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: #dee5ea; color: var(--text); }
.btn.warning { background: var(--accent); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.big { width: 100%; padding: 1rem; font-size: 1.1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { display: block; font-weight: 600; margin: .8rem 0 .3rem; }
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], textarea, select {
  width: 100%;
  padding: .65rem;
  border: 1px solid #ccd5db;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}
textarea { min-height: 80px; }

.field_with_errors input { border-color: var(--danger); }

/* ---- Map ---- */
/* Replis successifs : vh (partout), puis svh (zone toujours visible sur mobile,
   la barre d'URL ne recouvre jamais les boutons du bas). */
.map-wrap { position: relative; height: calc(100vh - 52px); height: calc(100svh - 52px); }
.fullscreen .map-wrap { height: 100vh; height: 100svh; }
.map { position: absolute; inset: 0; }
.map-preview { height: 300px; position: relative; border-radius: var(--radius); overflow: hidden; }

/* ---- Recorder / Player overlay bars ---- */
.hud {
  position: absolute;
  left: 0; right: 0;
  z-index: 20;
  display: flex;
  gap: .5rem;
  padding: .6rem;
}
.hud.top { top: 0; background: linear-gradient(rgba(0,0,0,.45), transparent); color: #fff; align-items: center; }
.hud.bottom { bottom: 0; padding-bottom: max(.6rem, env(safe-area-inset-bottom)); }
.hud .btn { flex: 1; box-shadow: var(--shadow); }
.hud-info { font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6); flex: 1; }
.hud-badge {
  background: var(--accent); color: var(--text);
  border-radius: 20px; padding: .25rem .7rem; font-weight: 700;
}

/* ---- Panels & modals ---- */
.panel-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.panel-backdrop.hidden, .hidden { display: none !important; }
.panel {
  background: var(--card);
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
}
.panel h2 { margin-top: 0; }

.media-toggle { display: flex; gap: .5rem; margin: .5rem 0; }
.media-toggle .btn { flex: 1; }
.media-toggle .btn.active { background: var(--primary-dark); color: #fff; }

.rec-audio { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; }
.rec-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--danger);
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: .2; } }

.choice-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }
.choice-row input[type="text"] { flex: 1; }
.choice-row input[type="radio"] { width: 20px; height: 20px; }

.step-media img, .step-media video { width: 100%; border-radius: var(--radius); }

.quiz-choice {
  display: block; width: 100%;
  margin: .4rem 0; padding: .8rem;
  border: 2px solid #ccd5db; border-radius: var(--radius);
  background: #fff; font-size: 1rem; text-align: left; cursor: pointer;
}
.quiz-choice.correct { border-color: var(--primary); background: #d8f3dc; }
.quiz-choice.wrong { border-color: var(--danger); background: #ffe5d9; }
.quiz-choice:disabled { cursor: default; opacity: .9; }

.qr-box { text-align: center; }
.qr-box svg { width: 220px; height: 220px; }

.adventure-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 0; border-bottom: 1px solid #e4e9ec;
}
a.step-link { text-decoration: none; color: inherit; }
a.step-link:active { background: #f1f4f6; }
.adventure-item:last-child { border-bottom: none; }
.badge { border-radius: 20px; padding: .15rem .6rem; font-size: .8rem; font-weight: 700; }
.badge.draft { background: #dee5ea; color: var(--muted); }
.badge.published { background: #d8f3dc; color: var(--primary-dark); }

.points-flash {
  text-align: center; font-size: 1.3rem; font-weight: 800;
  color: var(--primary); margin: .5rem 0;
}
.actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: .9rem; }

.perm-list { margin: 1rem 0; }
.perm-row { padding: .5rem 0; font-weight: 600; }

.gps-accuracy {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--danger);
  margin: .5rem 0;
}
.gps-accuracy.ok { color: var(--primary); }

/* ---- Boussole ---- */
.compass {
  position: absolute;
  right: .8rem;
  bottom: 5.2rem;
  z-index: 20;
  width: 86px;
  padding: .5rem .3rem;
  background: rgba(255, 255, 255, .92);
  border-radius: 50% 50% 12px 12px / 40% 40% 12px 12px;
  box-shadow: var(--shadow);
  text-align: center;
}
.compass-arrow {
  width: 34px; height: 34px;
  margin: 0 auto;
  transition: transform .3s ease-out;
}
.compass-distance { font-weight: 800; font-size: .95rem; color: var(--primary-dark); }
.compass-label {
  font-size: .68rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- Page d'accueil publique ---- */
.hero {
  margin: -1rem -1rem 1.5rem;
  padding: 3rem 1.5rem 3.5rem;
  background: linear-gradient(150deg, var(--primary-dark), var(--primary) 70%, #40916c);
  color: #fff;
  text-align: center;
  border-radius: 0 0 24px 24px;
}
.hero h1 { font-size: 1.9rem; line-height: 1.25; margin: 0 0 1rem; display: flex; align-items: center; justify-content: center; gap: .6rem; }
.hero-logo { width: 48px; height: 48px; }
.hero-sub {
  max-width: 34rem; margin: 0 auto 1.5rem;
  font-size: 1.05rem; line-height: 1.5; color: #d8f3dc;
}
.hero-actions {
  display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap;
}
.hero-btn { width: auto; min-width: 200px; }

.section-title { text-align: center; font-size: 1.4rem; margin: 2rem 0 1rem; }

.feature-cols { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .feature-cols { grid-template-columns: 1fr 1fr; } }
.feature-col h3 { margin-top: 0; }
.feature-steps { padding-left: 1.2rem; margin: 0; }
.feature-steps li { margin-bottom: .7rem; line-height: 1.45; }

.usecase-grid { display: grid; gap: .8rem; grid-template-columns: 1fr 1fr; }
@media (min-width: 640px) { .usecase-grid { grid-template-columns: repeat(4, 1fr); } }
.usecase { text-align: center; font-size: 1rem; line-height: 1.6; margin-bottom: 0; }

.cta-final { text-align: center; margin: 2rem 0; padding: 2rem 1rem; }
.cta-final h2 { margin-top: 0; }

/* ---- Auth (devise) ---- */
.auth-page { max-width: 420px; margin: 1.5rem auto; }
.auth-card { text-align: center; }
.auth-icon { font-size: 2.4rem; line-height: 1; margin-bottom: .4rem; }
.auth-card h1 { margin: 0 0 .3rem; font-size: 1.4rem; }
.auth-sub { margin: 0 0 1.3rem; line-height: 1.4; }
.auth-card form { text-align: left; }

.hint { display: block; color: var(--muted); font-size: .82rem; font-weight: 400; margin-top: .15rem; }

.checkbox-field { display: flex; align-items: center; gap: .5rem; margin: .9rem 0; }
.checkbox-field input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }
.checkbox-field label { margin: 0; font-weight: 500; }

#error_explanation {
  background: #ffe5d9;
  color: var(--danger);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  margin-bottom: 1rem;
  text-align: left;
}
#error_explanation h2 { font-size: .95rem; margin: 0 0 .4rem; }
#error_explanation ul { margin: 0; padding-left: 1.1rem; }
#error_explanation li { margin-bottom: .2rem; }

.auth-links {
  margin-top: 1.3rem;
  padding-top: 1rem;
  border-top: 1px solid #e4e9ec;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  font-size: .92rem;
}
.auth-links a, .auth-links .linklike { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-links a:hover, .auth-links .linklike:hover { text-decoration: underline; }

.auth-danger {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid #e4e9ec;
  text-align: left;
}
.auth-danger h3 { font-size: 1rem; color: var(--danger); margin: 0 0 .4rem; }
