/* ╔══════════════════════════════════════════════════════╗
   ║     WEBTROC — css/style.css                          ║
   ╚══════════════════════════════════════════════════════╝ */

:root {
  --bleu:        #2861A8;   /* le bleu historique de WebTroc */
  --bleu-clair:  #3d7fd4;
  --bleu-sombre: #1c4478;
  --fond:        #0f1420;
  --fond-2:      #172032;
  --carte:       #1e2a40;
  --bord:        #2b3a56;
  --texte:       #e8edf6;
  --texte-doux:  #9fb0c9;
  --vert:        #2eb872;
  --orange:      #e8973a;
  --rouge:       #e05263;
  --violet:      #9b6dd6;
  --rayon:       14px;
  --ombre:       0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  /* Encoches des téléphones récents : sans cela, l'entête passe sous la
     barre d'état sur iPhone. */
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--bleu-clair); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Entête ────────────────────────────────────────────── */
.entete {
  position: sticky; top: 0; z-index: 900;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #16233a, #131c2e);
  border-bottom: 1px solid var(--bord);
  flex-wrap: wrap;
}
.logo {
  font-size: 22px; font-weight: 800; color: var(--texte);
  text-decoration: none; white-space: nowrap;
}
.logo span { color: var(--bleu-clair); }

.recherche { display: flex; flex: 1 1 260px; min-width: 180px; }
.recherche input {
  flex: 1; min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--bord); border-right: 0;
  border-radius: 999px 0 0 999px;
  background: var(--fond-2); color: var(--texte); font-size: 15px;
}
.recherche button {
  padding: 10px 16px; border: 1px solid var(--bleu); border-left: 0;
  border-radius: 0 999px 999px 0;
  background: var(--bleu); color: #fff; cursor: pointer; font-size: 15px;
}
.recherche input:focus, .recherche button:focus-visible { outline: 2px solid var(--bleu-clair); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-lien {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px;
  color: var(--texte-doux); text-decoration: none; font-size: 14px; font-weight: 600;
  white-space: nowrap;
}
.nav-lien:hover { background: var(--fond-2); color: var(--texte); text-decoration: none; }
.nav-lien.actif { background: var(--bleu); color: #fff; }
.nav-publier { background: var(--vert); color: #fff; }
.nav-publier:hover { background: #26a463; color: #fff; }
.pastille {
  position: absolute; top: 2px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--rouge); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
}

/* Sur petit écran la navigation passe sous la recherche et devient une
   barre d'onglets : les libellés disparaissent, les émojis suffisent. */
@media (max-width: 720px) {
  .entete { padding: 8px 10px; gap: 8px; }
  .logo span { display: none; }
  .nav { order: 3; width: 100%; justify-content: space-between; }
  .nav-lien span { display: none; }
  .nav-lien { padding: 8px 10px; font-size: 18px; }
}

/* ── Structure ─────────────────────────────────────────── */
.vue { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; min-height: 60vh; }
.chargement { text-align: center; color: var(--texte-doux); padding: 60px 0; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 20px; margin: 28px 0 12px; }
.sous-titre { color: var(--texte-doux); margin: 0 0 20px; }

.pied {
  border-top: 1px solid var(--bord); padding: 20px 16px 40px;
  color: var(--texte-doux); font-size: 14px; text-align: center;
}

/* ── Blocs ─────────────────────────────────────────────── */
.bloc {
  background: var(--carte); border: 1px solid var(--bord);
  border-radius: var(--rayon); padding: 18px; margin-bottom: 16px;
}
.grille { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.deux-colonnes { display: grid; gap: 20px; grid-template-columns: 1.4fr 1fr; align-items: start; }
@media (max-width: 860px) { .deux-colonnes { grid-template-columns: 1fr; } }

/* ── Carte d'annonce ───────────────────────────────────── */
.annonce {
  background: var(--carte); border: 1px solid var(--bord);
  border-radius: var(--rayon); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .12s ease, border-color .12s ease;
}
.annonce:hover { transform: translateY(-2px); border-color: var(--bleu-clair); }
.annonce-photo {
  aspect-ratio: 4 / 3; background: var(--fond-2) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: var(--texte-doux); position: relative;
}
.annonce-corps { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.annonce-titre { font-weight: 700; font-size: 15px; line-height: 1.3; }
.annonce-prix { font-size: 18px; font-weight: 800; color: var(--vert); }
.annonce-meta { font-size: 13px; color: var(--texte-doux); margin-top: auto; }

.etiquette {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
}
.et-vente     { background: rgba(46,184,114,.18);  color: #6ee7a8; }
.et-troc      { background: rgba(155,109,214,.18); color: #c4a3f0; }
.et-don       { background: rgba(232,151,58,.18);  color: #f5bf7d; }
.et-recherche { background: rgba(61,127,212,.18);  color: #9ac4f5; }
.et-avant     { background: var(--orange); color: #221200; }
.badge-avant {
  position: absolute; top: 8px; left: 8px;
  background: var(--orange); color: #221200;
  font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
}

/* ── Boutons et formulaires ────────────────────────────── */
.bouton, button.bouton, a.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border: 0; border-radius: 999px;
  background: var(--bleu); color: #fff;
  font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.bouton:hover { background: var(--bleu-clair); text-decoration: none; }
.bouton:disabled { opacity: .5; cursor: not-allowed; }
.bouton-vert   { background: var(--vert); }
.bouton-vert:hover { background: #26a463; }
.bouton-rouge  { background: var(--rouge); }
.bouton-fantome {
  background: transparent; border: 1px solid var(--bord); color: var(--texte);
}
.bouton-fantome:hover { background: var(--fond-2); }
.bouton-petit { padding: 7px 14px; font-size: 13px; }

label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=tel], input[type=date], select, textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--bord); border-radius: 10px;
  background: var(--fond-2); color: var(--texte); font-size: 15px;
  font-family: inherit;
}
textarea { min-height: 130px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--bleu-clair); border-color: var(--bleu-clair); }
.aide { font-size: 13px; color: var(--texte-doux); margin-top: 5px; }
.ligne-cases { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; }
.ligne-cases input { width: auto; margin-top: 4px; }
.ligne-cases label { margin: 0; font-weight: 400; }
.champs-2 { display: grid; gap: 0 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .champs-2 { grid-template-columns: 1fr; } }

.erreur   { background: rgba(224,82,99,.14);  border: 1px solid var(--rouge);  color: #ffc3cb; padding: 12px 14px; border-radius: 10px; margin: 14px 0; }
.succes   { background: rgba(46,184,114,.14); border: 1px solid var(--vert);   color: #a8f0cb; padding: 12px 14px; border-radius: 10px; margin: 14px 0; }
.avert    { background: rgba(232,151,58,.14); border: 1px solid var(--orange); color: #f8d6a8; padding: 12px 14px; border-radius: 10px; margin: 14px 0; }
.vide     { text-align: center; color: var(--texte-doux); padding: 50px 20px; }
.vide-emoji { font-size: 52px; margin-bottom: 10px; }

/* ── Carte Leaflet ─────────────────────────────────────── */
#leaflet { height: 68vh; min-height: 380px; border-radius: var(--rayon); border: 1px solid var(--bord); }
.leaflet-popup-content-wrapper { background: var(--carte); color: var(--texte); border-radius: 12px; }
.leaflet-popup-tip { background: var(--carte); }
.popup-annonce { min-width: 190px; }
.popup-annonce img { border-radius: 8px; margin-bottom: 8px; }
.marqueur-prix {
  background: var(--bleu); color: #fff; border: 2px solid #fff;
  border-radius: 999px; padding: 3px 9px;
  font-size: 12px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.marqueur-troc { background: var(--violet); }
.marqueur-don  { background: var(--orange); color: #221200; }
.filtres-carte {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px;
}
.filtres-carte select, .filtres-carte input { width: auto; min-width: 130px; }

/* ── Fiche annonce ─────────────────────────────────────── */
.galerie { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.galerie img { border-radius: 10px; aspect-ratio: 1; object-fit: cover; cursor: pointer; }
.photo-principale { width: 100%; border-radius: var(--rayon); aspect-ratio: 4/3; object-fit: cover; background: var(--fond-2); }
.details dt { color: var(--texte-doux); font-size: 13px; }
.details dd { margin: 0 0 10px; font-weight: 600; }
.prix-fiche { font-size: 32px; font-weight: 800; color: var(--vert); }

/* ── Messagerie ────────────────────────────────────────── */
.fil { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; padding: 4px; }
.bulle { max-width: 78%; padding: 9px 13px; border-radius: 16px; background: var(--fond-2); }
.bulle.de-moi { align-self: flex-end; background: var(--bleu); color: #fff; }
.bulle-heure { font-size: 11px; opacity: .65; margin-top: 3px; }
.conversation {
  display: flex; gap: 12px; align-items: center; padding: 12px;
  border-bottom: 1px solid var(--bord); cursor: pointer;
}
.conversation:hover { background: var(--fond-2); }
.conversation img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.avatar-lettre {
  width: 46px; height: 46px; border-radius: 50%; flex: 0 0 46px;
  background: var(--bleu); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}

/* ── Tableaux (administration) ─────────────────────────── */
.tableau-defilant { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--bord); white-space: nowrap; }
th { color: var(--texte-doux); font-weight: 600; font-size: 13px; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.stat { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--texte-doux); font-size: 13px; }

/* ── WebCoins ──────────────────────────────────────────── */
.solde-coins {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #3a2d10, #4a3a12);
  border: 1px solid var(--orange); border-radius: var(--rayon);
  padding: 16px 18px; margin-bottom: 16px;
}
.solde-coins .montant { font-size: 30px; font-weight: 800; color: #ffd489; }
.solde-coins.negatif { background: linear-gradient(135deg, #3d1620, #4d1c28); border-color: var(--rouge); }
.solde-coins.negatif .montant { color: #ffb3bd; }
.pack {
  background: var(--carte); border: 1px solid var(--bord);
  border-radius: var(--rayon); padding: 18px; text-align: center;
}
.pack .coins { font-size: 30px; font-weight: 800; color: #ffd489; }
.pack .prix { font-size: 20px; font-weight: 700; margin: 6px 0; }
.pack .unitaire { font-size: 13px; color: var(--texte-doux); }

/* ── Toasts et modale ──────────────────────────────────── */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1200;
          display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast {
  background: var(--carte); border: 1px solid var(--bord); border-left: 4px solid var(--bleu);
  border-radius: 10px; padding: 12px 16px; box-shadow: var(--ombre);
  animation: entree .2s ease;
}
.toast.err { border-left-color: var(--rouge); }
.toast.ok  { border-left-color: var(--vert); }
@keyframes entree { from { opacity: 0; transform: translateY(12px); } }

.modale {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modale[hidden] { display: none; }
.modale-boite {
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 22px; width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  box-shadow: var(--ombre);
}

/* Réduction d'animation : réglage système respecté. */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
