/* --- Style global --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #0b0c0f;
  color: #f5f5f5;
  line-height: 1.6;
}

/* --- En-tête et navigation --- */
header {
  background-color: #1a1c20;
  padding: 1rem 0;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

nav a {
  color: #9664c9;
  text-decoration: none;
  margin: 0 0.8rem;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

nav a:hover {
  color: #ffffff;
}

/* --- Corps de page --- */
main {
  padding: 2rem 1rem;
  max-width: 800px;
  margin: auto;
  text-align: center;
}

h2 {
  color: #9664c9;
  margin-bottom: 1rem;
}

p {
  color: #d0d0d0;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}


/* --- Liens --- */
a {
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.8;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  nav a {
    display: inline-block;
    margin: 0.3rem 0.5rem;
  }
}
/* --- Header version 2 --- */
.navbar {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.logo span {
  color: #f6c44b;
}

nav a {
  color: #9664c9;
  margin-left: 1rem;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

nav a:hover {
  color: #ffffff;
  transform: translateY(-1px);
}
/* --- Section Hero --- */
.hero {
  padding: 4rem 1rem 3rem;
  text-align: center;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #ffffff;
}

.hero p {
  color: #d0d0d0;
  max-width: 600px;
  margin: 0 auto 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
}

/* --- Boutons --- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 50px;
  border: 1px solid #9664c9;
  color: #9664c9;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn:hover {
  background-color: #9664c9;
  color: #0b0c0f;
}
/* --- Cartes topo --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  padding: 1rem;
  background-color: #15171c;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  font-size: 0.9rem;
}

.card strong {
  color: #9664c9;
}

.info {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: #aaaaaa;
}
/* Formulaire d'accès membres */
input[type="password"] {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background-color: #0b0c0f;
  color: #ffffff;
  margin-right: 0.5rem;
  margin-top: 0.5rem;
}

.error-message {
  color: #ff4b4b;
  font-size: 0.85rem;
  margin-top: 0.4rem;
}
/* --- Onglets espace membres --- */
.tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tab-link {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background-color: transparent;
  color: #f5f5f5;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-link.active {
  background-color: #9664c9;
  color: #0b0c0f;
  border-color: #9664c9;
  font-weight: 600;
}

.tab-link:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.tab-content {
  display: none;
  text-align: left;
  max-width: 900px;
  margin: 0 auto 2rem;
}

.tab-content.active {
  display: block;
}

#lignes-container,
#secteurs-container,
#carte-container,
#contributeurs-container {
  margin-top: 1rem;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.card {
  padding: 1rem;
  background-color: #15171c;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
}

.card .info {
  color: #a9a9a9;
  font-size: 0.85rem;
  margin-top: 0.2rem;
}
/* --- Liste de lignes (layout image à gauche / texte à droite) --- */
.line-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.line-card {
  display: flex;
  gap: 1rem;
  background-color: #15171c;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0.9rem;
  align-items: stretch;
}

.line-media {
  flex: 1;              /* ≈ 1/3 */
  min-width: 220px;     /* garde une largeur mini correcte */
  max-width: 360px;     /* évite les images trop larges sur grands écrans */
}

.line-media img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

.line-body {
  flex: 2;              /* ≈ 2/3 */
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.line-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.line-meta, .line-info {
  color: #a9a9a9;
  font-size: 0.9rem;
}

.line-desc {
  color: #d6d6d6;
}

/* Responsive : sur mobile on empile */
@media (max-width: 720px) {
  .line-card {
    flex-direction: column;
  }
  .line-media {
    min-width: unset;
    max-width: 100%;
  }
}
/* --- Lightbox / modal images --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 1000;
  padding: 1rem;
}
.modal.open {
  opacity: 1;
  pointer-events: auto;
}
.modal img {
  max-width: 95vw;
  max-height: 85vh;
  border-radius: 10px;
  display: block;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 999px;
  padding: .4rem .6rem;
  cursor: pointer;
  font-size: 1rem;
}
@media (max-width: 720px) {
  .modal img { max-width: 100vw; max-height: 80vh; }
}
/* Filtres Lignes */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.filters select,
.filters input[type="text"] {
  padding: .45rem .6rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  background: #0b0c0f;
  color: #fff;
  font-size: .9rem;
}

.filters .f-inline {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .9rem;
  color: #d0d0d0;
}

.filters .range {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 180px;
}

.filters .range input[type="range"] {
  width: 180px;
}

#lignes-count {
  text-align: center;
}
/* --- Secteurs & Faces --- */
.secteur-list {
  display: grid;
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
}
.secteur-card {
  background: #15171c;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 1rem;
}
.secteur-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
}
.secteur-title {
  font-weight: 700;
  font-size: 1rem;
}
.secteur-meta {
  color: #a9a9a9;
  font-size: .9rem;
}
.secteur-toggle {
  padding: .35rem .7rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.faces-wrap {
  margin-top: .8rem;
  display: grid;
  gap: .8rem;
}
.face-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: .8rem;
  background: #0f1116;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: .8rem;
}
.face-card img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}
.face-title { font-weight: 600; }
.face-meta, .face-desc, .face-lines {
  color: #cfcfcf;
  font-size: .9rem;
}
.face-lines a {
  color: #9664c9; text-decoration: none;
}
.face-lines a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .face-card { grid-template-columns: 1fr; }
}
/* Highlight d'une ligne ciblée */
.line-card.highlight {
  outline: 2px solid #9664c9;
  box-shadow: 0 0 0 4px rgba(255,107,61,0.25);
  animation: pulseHighlight 1.2s ease-out 0s 1;
}
@keyframes pulseHighlight {
  0%   { box-shadow: 0 0 0 10px rgba(255,107,61,0.0); }
  50%  { box-shadow: 0 0 0 6px  rgba(255,107,61,0.35); }
  100% { box-shadow: 0 0 0 4px  rgba(255,107,61,0.25); }
}
/* --- Formulaire Proposer une ligne --- */
.line-form {
  max-width: 800px;
  margin: 1rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.line-form fieldset {
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 0.9rem 1rem 1.1rem;
}

.line-form legend {
  padding: 0 0.5rem;
  font-weight: 600;
  color: #9664c9;
}

.line-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.line-form input[type="text"],
.line-form input[type="email"],
.line-form input[type="number"],
.line-form select,
.line-form textarea,
.line-form input[type="file"] {
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  background: #0b0c0f;
  color: #fff;
  font-size: 0.9rem;
}

.line-form textarea {
  resize: vertical;
}

.inline-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

.drops-fields {
  display: none;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.drops-fields.active {
  display: flex;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .line-form fieldset {
    padding: 0.8rem;
  }
}
.hidden {
  display: none;
}

.line-form .sub-note {
  font-size: 0.8rem;
  color: #a9a9a9;
  margin-top: 0.2rem;
}

.face-photo-download {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #d0d0d0;
}

.face-photo-download img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin-top: 0.3rem;
}

.face-photo-download a {
  display: inline-block;
  margin-top: 0.3rem;
  font-size: 0.85rem;
  text-decoration: none;
  color: #9664c9;
}

.face-photo-download a:hover {
  text-decoration: underline;
}
.link-button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: #9664c9;
  cursor: pointer;
  text-decoration: none;
}

.link-button:hover {
  text-decoration: underline;
}

/* Highlight d'une face ciblée */
.face-card.highlight {
  outline: 2px solid #9664c9;
  box-shadow: 0 0 0 4px rgba(255,107,61,0.25);
  animation: pulseHighlight 1.2s ease-out 0s 1;
}
/* --- Carte topo (image pan/zoom) --- */
.map-wrapper {
  max-width: 1000px;
  height: 520px;
  margin: 1rem auto;
  border-radius: 12px;
  overflow: hidden;
  background: #050608;
  border: 1px solid rgba(255,255,255,0.15);
  position: relative;
  touch-action: none; /* important pour mobile */
}

/* Conteneur interne qui contient l'image + futurs marqueurs */
#map-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 8354px;   /* largeur réelle de l'image */
  height: 6782px;  /* hauteur réelle de l'image */
  transform-origin: 0 0;
  cursor: grab;
}

#map-viewport.dragging {
  cursor: grabbing;
}

/* L'image prend toute la taille de map-viewport */
#freeride-map {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  user-select: none;
  pointer-events: none; /* on veut choper le conteneur, pas l'image */
  display: block;
}

#map-links {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* --- Marqueurs sur la carte --- */
#map-markers {
  position: absolute;
  inset: 0;
  pointer-events: none; /* on réactive sur les marqueurs */
  font-size: 0.85rem;
}

/* Base pour tous les marqueurs */
.marker {
  position: absolute;
  display: inline-flex;
  flex-direction: column;        /* nom au-dessus, texte en dessous */
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 5;
  text-align: center;
  transform-origin: center center;
}

/* Bulle secteur */
.marker-sector {
  cursor: pointer;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(5, 6, 8, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f5f5f5;
  font-size: 0.8rem;
  white-space: nowrap;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.65);
}

/* Bulle face : un peu plus compacte, 2 lignes max */
.marker-face {
  cursor: pointer;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;          /* rond/pill */
  background: rgba(10, 12, 16, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f0f0f0;
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: normal;           /* autorise retour à la ligne */
  min-width: 3.2rem;
  min-height: 3.2rem;            /* donne une bulle visuellement ronde */
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

/* Ligne "X lignes" dans la bulle face */
.marker-face-count {
  font-size: 0.7rem;
  opacity: 0.9;
}


/* Highlight du secteur ouvert depuis la carte */
.secteur-card.highlight {
  outline: 2px solid #9664c9;
  box-shadow: 0 0 0 4px rgba(255,107,61,0.25);
  animation: pulseHighlight 1.2s ease-out 0s 1;
}


.map-attrib {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #9b9b9b;
  text-align: center;
}

@media (max-width: 768px) {
  .map-wrapper {
    height: 360px;
  }
}
html, body {
  height: 100%;
}

/* Le body devient une colonne : header en haut, main au milieu, footer en bas */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Le main prend toute la place restante entre header et footer */
main {
  flex: 1 0 auto;
}

.footer-frise {
  width: 100%;
  height: 180px;           /* hauteur visible du bandeau */
  background-image: url("images/frise.png");
  background-repeat: repeat-x;   /* répète horizontalement si nécessaire */
  background-position: bottom center;
  background-size: auto 100%;    /* garde la forme, s’ajuste en hauteur */

  margin-top: 3rem;        /* espace avant la frise */
}
#ajouter-ligne {
  display: none;
}

#ajouter-ligne.visible {
  display: block;
}
/* Bandeau BERA en haut du topo */
.bera-banner {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0 1.5rem 0;
}

/* Bouton BERA */
.btn-bera {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;

  background: #ffffff;          /* ton jaune soleil */
  color: #111;
  border: 1px solid #111;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-bera:hover {
  filter: brightness(1.05);
}

/* Petit logo inspiré BERA : carré coupé en diagonale, sans numéro */
.bera-icon {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 0.2rem;
  border: 1px solid #111;
  box-sizing: border-box;

  background: linear-gradient(
    135deg,
    #111 0%,
    #111 50%,
    #f6c44b 50%,
    #f6c44b 100%
  );
}
/* Conteneur des cartes publiques */
.lignes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Card publique de ligne */
.public-ligne-card {
  background: var(--bg-card, #15171c);
  border-radius: 0.75rem;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 1rem;
  text-align: left;            /* très important : plus centré */
}

/* Mise en page interne : photo à gauche, texte à droite */
.public-ligne-card .ligne-body {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

/* Colonne photo = environ 1/3 */
.ligne-photo-col {
  flex: 0 0 30%;
  max-width: 30%;
}

.ligne-photo-col img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0.5rem;
}

/* Colonne texte = le reste */
.ligne-text-col {
  flex: 1 1 0;
}

/* Un peu de style pour le texte */
.public-ligne-card .ligne-header h3 {
  margin: 0 0 0.3rem 0;
}

.public-ligne-card .ligne-meta {
  font-size: 0.85rem;
  color: #666;
}

.public-ligne-card .ligne-texte p {
  margin: 0.3rem 0;
}

.public-ligne-card .ligne-stats {
  font-size: 0.85rem;
  color: #555;
}

.public-ligne-card .ligne-contrib {
  font-size: 0.85rem;
  color: #777;
}

/* Modal image pour le topo public */
.public-image-modal {
  position: fixed;
  inset: 0;
  display: none;               /* caché par défaut */
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.public-image-modal.open {
  display: flex;               /* affiché quand on ajoute .open */
}

.public-image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}

.public-image-modal-content {
  position: relative;
  background: #111;
  padding: 0.5rem;
  border-radius: 0.75rem;
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  z-index: 1;
}

.public-image-modal-content img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
}

.public-image-modal-close {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 1rem;
}
.parag-normal {
  text-align: justify;
  display: block;
  width: 100%;
  margin: 1.5rem 0; /* optionnel */
}