/* ===================================================
   NONMARCHAND.ORG — local.css
   Style chaleureux / communautaire — version modernisée
   =================================================== */

/* --- Variables de couleur --- */
:root {
  --vert-foret:   #1D8074;
  --vert-clair:   #4aab9a;
  --vert-pale:    #e8f4f1;
  --ocre:         #c17f3b;
  --ocre-pale:    #fdf3e7;
  --beige:        #f7f3ec;
  --beige-fonce:  #ede8df;
  --violet:       #6a3fa8;
  --violet-pale:  #f0ebfa;
  --bleu-pale:    #e8f0fb;
  --rose-pale:    #fde8f0;
  --texte:        #2d2d2d;
  --texte-doux:   #555555;
  --ombre:        rgba(60, 60, 60, 0.10);
  --ombre-forte:  rgba(60, 60, 60, 0.18);
  --sidebar-w:    190px;
}

/* ===================================================
   LAYOUT — flexbox sur divs (tmpl modernisé)
   =================================================== */

/* Conteneur global sidebar + contenu */
#wikiwrap {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  align-items: start;
  width: 100%;
  min-height: 100vh;
  box-sizing: border-box;
}

/* Sidebar */
#wikileft {
  grid-column: 1;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  /* Style */
  background: linear-gradient(180deg, var(--beige) 0%, #f0ece3 100%);
  border-right: 1px solid var(--beige-fonce);
  font-family: 'Georgia', 'Palatino Linotype', serif;
  font-size: 9.6pt;
  line-height: 1.5em;
  padding: 10px 10px;
  box-shadow: 2px 0 8px var(--ombre);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Zone de contenu principal */
#wikimain {
  grid-column: 2;
  min-width: 0;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 28px 24px 28px;
  box-sizing: border-box;
}


/* ===================================================
   RESPONSIVE — tablette (700–1100px)
   =================================================== */

@media (min-width: 701px) and (max-width: 1100px) {
  :root { --sidebar-w: 175px; }
  #wikiwrap { grid-template-columns: var(--sidebar-w) 1fr; }
  #wikimain { padding: 0 16px 16px 16px; }
}

/* ===================================================
   RESPONSIVE — grand écran (> 1100px)
   =================================================== */

@media (min-width: 1101px) {
  :root { --sidebar-w: 215px; }
  #wikiwrap { grid-template-columns: var(--sidebar-w) 1fr; }
}

/* ===================================================
   RESPONSIVE — mobile (< 700px)
   =================================================== */

@media (max-width: 700px) {
  #wikiwrap {
    grid-template-columns: 1fr;
  }

  #wikileft {
    grid-column: 1;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none;
    position: static;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--beige-fonce);
    box-shadow: 0 2px 8px var(--ombre);
  }

  #wikimain {
    grid-column: 1;
    max-width: 100%;
    padding: 0 12px 16px 12px;
  }
/* --- Tableaux en mode fiches empilées sur mobile --- */
  table.liste,
  table.sortable,
  table.recherche {
    display: block;
    width: 100% !important;
    border-spacing: 0;
  }

  table.liste thead,
  table.sortable thead,
  table.recherche thead {
    display: none;
  }

  table.liste tbody,
  table.sortable tbody,
  table.recherche tbody {
    display: block;
  }

  table.liste tr,
  table.sortable tr,
  table.recherche tr {
    display: block;
    background-color: #ffffff;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px 12px;
    box-shadow: 0 2px 6px var(--ombre);
  }

  table.liste td,
  table.liste th,
  table.sortable td,
  table.sortable th,
  table.recherche td,
  table.recherche th {
    display: block;
    text-align: left;
    padding: 4px 0;
    border: none;
    background: transparent;
    font-style: normal;
  }

  table.sortable {
    width: 100% !important;
    padding: 0;
    border-spacing: 0;
  }
}

/* --- Typographie générale --- */
body {
  font-family: 'Georgia', 'Palatino Linotype', serif;
  color: var(--texte);
  background-color: #faf8f4;
  line-height: 1.65;
}

/* ===================================================
   BLOCS COMBINÉS — harmonisation générale
   =================================================== */

div.form, div.intgros,
table.espaceperso, table.fiche, table.formulaire,
table.formulairegeneral, table.liste, table.listecategorie,
table.menu, table.premierecolonne, table.recherche,
table.sommaire, table.sommairegeneral, table.titre {
  padding: 14px;
  border-radius: 10px;
  transition: box-shadow 0.2s ease;
}

table.espaceperso, table.formulaire, table.listecategorie,
table.menu, table.recherche, table.sommaire, table.sommairegeneral {
  text-align: center;
  font-weight: bold;
  font-family: 'Georgia', 'Palatino Linotype', serif;
}

/* ===================================================
   COULEURS TEXTE
   =================================================== */

.brillant, .date, .tresbrillant { color: var(--vert-foret); font-weight: bold; }
.wiki                           { color: #2a7a2a; }
.tresbrillant, .date            { font-size: large; }

/* ===================================================
   BLOCS DIV
   =================================================== */

div.form, div.intgros {
  display: block;
  margin-left: auto;
  margin-right: auto;
  border: none;
  text-align: center;
  font-weight: bold;
  box-shadow: 0 3px 10px var(--ombre);
}

div.form {
  background-color: var(--bleu-pale);
  width: 60%;
  border-left: 4px solid var(--vert-foret);
}

div.intgros {
  background: linear-gradient(135deg, var(--beige) 0%, var(--vert-pale) 100%);
  width: 220px;
  padding: 16px 20px;
  margin-top: 8px;
  margin-bottom: 6px;
  box-shadow: 0 5px 18px var(--ombre-forte);
  font-family: 'Georgia', serif;
  font-size: 1.08em;
  letter-spacing: 0.02em;
  border-top: 3px solid var(--vert-foret);
}

/* ===================================================
   TABLE — espaceperso (bandeau utilisateur)
   =================================================== */

table.espaceperso {
  background: linear-gradient(135deg, var(--violet-pale) 0%, var(--beige) 100%);
  border: 2px solid var(--vert-foret);
  color: var(--violet);
  box-shadow: 0 3px 10px var(--ombre);
  letter-spacing: 0.02em;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ===================================================
   TABLE — fiche (blocs de la page profil)
   =================================================== */

table.fiche {
  background-color: var(--beige);
  padding: 0;
  border-radius: 10px;
  box-shadow: 0 2px 10px var(--ombre);
  border: 1px solid var(--beige-fonce);
  width: 100%;
  margin-bottom: 22px;
  overflow: hidden;
}

table.fiche th {
  padding: 12px 16px;
  color: var(--vert-foret);
  background: linear-gradient(90deg, var(--vert-pale) 0%, #f0f7f5 60%, var(--beige) 100%);
  font-family: 'Georgia', serif;
  font-size: 1.05em;
  font-style: normal;
  font-weight: bold;
  text-align: left;
  border-bottom: 2px solid var(--beige-fonce);
  letter-spacing: 0.04em;
}

table.fiche td {
  background-color: #ffffff;
  padding: 10px 14px;
  vertical-align: top;
}

table.fiche tr:last-child td {
  border-radius: 0 0 10px 10px;
}

/* ===================================================
   TABLE — formulaire
   =================================================== */

table.formulaire {
  background: linear-gradient(135deg, var(--ocre-pale) 0%, var(--beige) 100%);
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 2px 8px var(--ombre);
  border: 1px solid #e8d5be;
  border-top: 3px solid var(--ocre);
  border-radius: 10px;
  overflow: hidden;
}

table.formulaire td {
  padding: 10px 14px;
  text-align: center;
}

/* Boutons submit dans les formulaires */
table.formulaire input[type="submit"] {
  background-color: var(--ocre);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-family: 'Georgia', serif;
  font-size: 0.95em;
  cursor: pointer;
  transition: background 0.15s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

table.formulaire input[type="submit"]:hover {
  background-color: #a86a2a;
}

/* Liens-boutons (cas non connecté) */
table.formulaire a {
  display: inline-block;
  background-color: var(--ocre);
  color: white !important;
  border-radius: 6px;
  padding: 6px 16px;
  font-family: 'Georgia', serif;
  font-size: 0.95em;
  text-decoration: none !important;
  transition: background 0.15s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

table.formulaire a:hover {
  background-color: #a86a2a;
}

/* Champs texte dans les formulaires */
table.formulaire input[type="text"],
table.formulaire input:not([type]),
table.formulaire select {
  border: 1px solid #e8d5be;
  border-radius: 5px;
  padding: 4px 8px;
  background-color: #ffffff;
  font-family: 'Georgia', serif;
  font-size: 0.9em;
}

table.formulairegeneral {
  background-color: var(--beige);
}

table.formulairegeneral th {
  font-style: bold;
  color: var(--vert-foret);
  text-align: right;
}

/* ===================================================
   TABLE — liste
   =================================================== */

table.liste {
  background-color: var(--beige);
  border-spacing: 10px;
  box-shadow: 0 2px 8px var(--ombre);
}

table.liste td {
  background-color: #ffffff;
  padding: 1.2em;
  line-height: 1.7;
  border-radius: 6px;
}

table.liste th {
  padding: 1em;
  color: var(--vert-foret);
}

table.liste tr { padding: 1em; }

/* ===================================================
   TABLE — listecategorie
   =================================================== */

table.listecategorie { border-spacing: 10px; }

/* ===================================================
   TABLE — menu (navigation utilisateur)
   =================================================== */

table.menu {
  background: linear-gradient(180deg, #ffffff 0%, var(--vert-pale) 100%);
  border-collapse: separate;
  vertical-align: middle;
  border-spacing: 10px 12px;
  box-shadow: 0 4px 18px var(--ombre-forte);
  border-radius: 10px;
  border-top: 3px solid var(--vert-foret);
  margin-bottom: 22px;
}

table.menu td, table.menu th {
  border-radius: 6px;
  transition: background 0.15s ease;
}

/* Liens de section du menu — couleurs par catégorie */
table.menu td a[href*="EspacesDeGratuite"] { color: #1a7a3a; }
table.menu td a[href*="Agenda"]             { color: #a0306a; }
table.menu td a[href*="Objets"]             { color: #b85c00; }
table.menu td a[href*="Activites"]          { color: #1a5fa0; }

table.menu td a:hover { text-decoration: underline; opacity: 0.85; }

/* ===================================================
   TABLE — sortable
   =================================================== */

table.sortable {
  width: 80%;
  box-shadow: 0 3px 12px var(--ombre-forte);
  padding: 10px;
  border-spacing: 20px;
  border-radius: 8px;
}

table.sortable th {
  background: linear-gradient(to right, transparent, var(--bleu-pale));
  font-family: 'Georgia', serif;
  text-align: center;
  vertical-align: middle;
  padding: 10px;
  border-radius: 5px;
  color: var(--vert-foret);
}

table.sortable td {
  background-color: #f7f7f7;
  font-style: italic;
  text-align: center;
  vertical-align: middle;
  padding: 10px;
  border-radius: 5px;
}

/* ===================================================
   TABLE — premierecolonne
   =================================================== */

table.premierecolonne {
  border-collapse: separate;
  border-spacing: 10px;
}

table.premierecolonne th {
  background-color: var(--vert-pale);
  vertical-align: middle;
  font-style: italic;
  color: var(--vert-foret);
}

table.premierecolonne td {
  background-color: var(--bleu-pale);
}

/* ===================================================
   TABLE — recherche
   =================================================== */

table.recherche {
  border-spacing: 1px;
  box-shadow: 0 3px 12px var(--ombre-forte);
  border-radius: 8px;
  overflow: hidden;
}

table.recherche th {
  background-color: var(--beige);
}

/* ===================================================
   TABLE — sommaire
   =================================================== */

table.sommaire {
  background-color: white;
  box-shadow: 0 2px 8px var(--ombre);
}

table.sommaire th {
  font-size: x-large;
  color: var(--vert-foret);
  font-family: 'Georgia', serif;
}

/* ===================================================
   TABLE — sommairegeneral
   =================================================== */

table.sommairegeneral {
  background-color: white;
  width: 100%;
  max-width: 270px;
  margin-left: auto;
  margin-right: auto;
  table-layout: fixed;
  box-shadow: 0 2px 8px var(--ombre);
}

table.sommairegeneral th {
  font-size: larger;
  color: var(--vert-foret);
}

/* ===================================================
   TABLE — titre
   =================================================== */

table.titre td {
  background-color: var(--ocre-pale);
  line-height: 1.8;
  border-left: 4px solid var(--ocre);
  padding-left: 14px;
}

/* ===================================================
   CLASSES DE TITRE
   =================================================== */

.titre0, .titre1, .titre2, .titre3, .titre4 {
  font-weight: bold;
  color: var(--vert-foret);
  font-family: 'Georgia', serif;
}

.titre0 { text-align: center; font-size: xx-large; letter-spacing: 0.04em; }
.titre1 { font-size: x-large; }
.titre2 { font-size: large; }
.titre4 { margin-left: 20px; font-style: italic; }

/* ===================================================
   GALERIE D'IMAGES (thumbs)
   =================================================== */

img.thumbs {
  border: 1px solid #e0ddd6;
  margin: 3px;
  padding: 4px;
  vertical-align: middle;
  border-radius: 4px;
  transition: border-color 0.15s ease;
}

img.thumbs:hover,
table.thumbtable td.thumbtd div.img:hover {
  border: 1px solid var(--ocre);
}

table.thumbtable img.thumbs       { border: 0; padding: 0; }
table.thumbtable td.thumbtd       { margin: 4px; padding: 2px; }
table.thumbtable td.thumbtd:hover { border-color: var(--ocre); }
table.thumbtable                  { border: 1px solid #ddd; border-radius: 6px; }

table.thumbtable td.thumbtd div.img {
  border: 1px solid #e0ddd6;
  text-align: center;
  border-radius: 4px;
}

.caption {
  font-size: .82em;
  overflow: hidden;
  padding: 2px 0;
  line-height: 1.2em;
  color: var(--texte-doux);
  font-style: italic;
}

img.current,
table.thumbtable td.thumbtd div.current {
  border-color: var(--ocre);
}

/* ===================================================
   CORRECTIONS CARTE APE / espaces blancs
   =================================================== */

/* Espacement général du contenu de page */
#wikicontent, .wikicontent, #wikitext {
  padding-top: 8px;
  padding-left: 2.5%;
  padding-right: 2.5%;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Les fiches et menu ne débordent pas de leur conteneur */
table.fiche, table.menu {
  width: 100%;
  box-sizing: border-box;
}

/* Bloc localisation — intégration visuelle */
table.fiche td dl.map,
table.fiche td .leaflet-container {
  border-radius: 8px;
  overflow: hidden;
  margin-top: 6px;
}

/* Resserrer l'espace entre intgros et le menu qui suit *//* Séparateur entre menu et premières fiches */
table.menu + table.fiche {
  margin-top: 16px;
}

/* ===================================================
   TITRES DE SECTION — plus marqués
   =================================================== */

table.fiche th {
  background: linear-gradient(90deg, #d4ede8 0%, #eaf4f1 50%, var(--beige) 100%) !important;
  border-left: 4px solid var(--vert-foret) !important;
  padding-left: 14px !important;
}

/* ===================================================
   STRUCTURE THÈME — #wikileft, #wikibody, etc.
   =================================================== */

/* Zone de contenu principal */
#wikibody {
  background-color: #faf8f4;
}

#wikitext {
  background-color: #faf8f4;
  margin: 12px 18px;
  line-height: 1.65;
}

/* Barre de commandes (Éditer, Historique…) */
#wikicmds {
  background-color: var(--beige-fonce);
  font-family: 'Georgia', serif;
  font-size: 0.78em;
  border-bottom: 1px solid var(--beige-fonce);
  color: var(--texte-doux);
}

#wikicmds li a       { color: var(--texte-doux); }
#wikicmds li a:hover { color: var(--vert-foret); }

/* Pied de page */
#wikifoot {
  clear: both;
  margin: 24px 10px 10px 10px;
  background: linear-gradient(135deg, var(--vert-foret) 0%, #155f56 100%);
  color: rgba(255,255,255,0.88);
  border-radius: 10px;
  font-family: 'Georgia', serif;
  font-size: 0.82em;
  margin: 10px;
  padding: 12px 16px;
  line-height: 1.6;
}

#wikifoot a       { color: rgba(255,255,255,0.75); }
#wikifoot a:hover { color: #ffffff; text-decoration: underline; }

/* ===================================================
   SIDEBAR — #wikileft
   =================================================== */

/* Espacement entre blocs sidebar */
#wikileft .vspace { margin-top: 14px; }

/* Contrainte générale — rien ne dépasse la sidebar */
#wikileft * {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Tables spécifiques dans la sidebar — largeurs adaptatives */
#wikileft table.sommaire,
#wikileft table.sommairegeneral,
#wikileft table.espaceperso,
#wikileft table.formulaire,
#wikileft table.formulairegeneral {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

/* Cellules — permettre le retour à la ligne */
#wikileft td, #wikileft th {
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
}

/* Images inline avec width= forcé via attribut HTML */
#wikileft img {
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
}

/* Liens sidebar */
#wikileft a {
  color: var(--texte);
  text-decoration: none;
  transition: color 0.15s ease;
}

#wikileft a:hover {
  color: var(--vert-foret);
  text-decoration: underline;
}

/* Titres de section sidebar (.sidehead) */
.sidehead {
  margin: 6px 0 4px 0;
  padding: 5px 8px;
  font-family: 'Georgia', serif;
  font-size: 10.5pt;
  font-weight: bold;
  color: var(--vert-foret);
  background: linear-gradient(90deg, var(--vert-pale), transparent);
  border-left: 3px solid var(--vert-foret);
  border-radius: 0 5px 5px 0;
}

.sidehead a {
  color: var(--vert-foret) !important;
  font-weight: bold;
}

/* Tables dans la sidebar — remplacer le style outset */
#wikileft table {
  border: 1px solid var(--beige-fonce) !important;
  border-radius: 8px;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow: 0 2px 6px var(--ombre);
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
  border-collapse: separate;
  border-spacing: 0;
}

#wikileft table td {
  padding: 6px 10px;
  line-height: 1.6;
  vertical-align: top;
}

#wikileft table th {
  background: linear-gradient(90deg, var(--vert-pale), var(--beige));
  color: var(--vert-foret);
  padding: 7px 10px;
  font-family: 'Georgia', serif;
  border-bottom: 1px solid var(--beige-fonce);
  text-align: center;
}

/* Boutons dans la sidebar et dans table.recherche */
#wikileft input[type="submit"],
#wikileft button,
table.recherche input[type="submit"],
table.recherche button {
  background-color: var(--vert-foret);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-family: 'Georgia', serif;
  font-size: 9pt;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-top: 4px;
}

#wikileft input[type="submit"]:hover,
#wikileft button:hover,
table.recherche input[type="submit"]:hover,
table.recherche button:hover {
  background-color: var(--vert-clair);
}

/* Select dans la sidebar */
#wikileft select {
  border: 1px solid var(--beige-fonce);
  border-radius: 5px;
  padding: 3px 6px;
  background-color: var(--beige);
  font-family: 'Georgia', serif;
  font-size: 9pt;
}

/* Logo / en-tête sidebar */
#haut {
  background-color: #faf8f4;
}

#haut a:hover { color: var(--vert-foret); }

div[style*="display: none"] .vspace,
div[style*="display: none"] > .vspace {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
}

.fpltemplate + div[style*="display: none"] {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
}

.fpltemplate { margin-bottom: 0 !important; }

dl.map { margin-bottom: 0 !important; }

.round.lrindent.important { margin-top: 10px !important; }
