/* ==========================================================================
   1. VARIABLES & CONFIGURATION
   ========================================================================== */

:root {
    --black: #000;
    --white: #fff;
    --blue: #065465;
    --gray: #f2f2f2;
    --border: #ddd;
}

/* ==========================================================================
   2. BASE & TYPOGRAPHIE
   ========================================================================== */

html {
    scroll-behavior: smooth;
    overflow-y: scroll;
}

body {
    margin: 0;
    height: 100%;
    line-height: 1.2;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
}

body.modal-open {
  overflow: hidden;
  padding-right: 15px; /* largeur scrollbar */
}

a {
    color: #000; /* Noir pur */
    text-decoration: none; /* Pas de soulignement par défaut */
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

h1 { 
    font-size: 3rem; 
    font-weight: 800; 
    text-transform: uppercase; 
    margin-bottom: 40px; 
}

hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 30px 0;
}

.section-title {
    text-transform: uppercase;
    font-size: 1.2rem;
    border-bottom: 2px solid black;
    padding-bottom: 10px;
    margin: 30px 0 20px 0;
}

.small-text {
    font-size: 0.9rem;
    color: #444;
    font-style: italic;
}

.empty-state {
    padding: 40px;
    text-align: center;
    background-color: #fcfcfc;
    border: 1px dashed #ddd;
    margin: 10px 0;
}

.empty-state p {
    color: #999;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer {
    text-align: center;
    margin-top: 20px;
}

.footer p {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8rem;
    margin-bottom: 20px;
}

/* ==========================================================================
   3. NAVIGATION & LAYOUT
   ========================================================================== */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh; 
}

.container { 
    width: 100%;
    flex: 1;
    padding: 40px 0;
    padding-inline: clamp(1rem, 4vw, 2rem);
    max-width: 1280px;
    margin: 0 auto; 
    box-sizing: border-box;
}

.navbar {
    border-bottom: 3px solid black;
}

.nav-container {
    height: 70px;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.logo { 
    font-weight: 900; 
    text-decoration: none; 
    color: black; 
    font-size: 1.5rem;
}

.logo img {
    display: block;
    height: 20px;
    width: auto;
    filter: grayscale(100%);
    transition: filter 0.2s ease;
}

.logo:hover img {
    filter: grayscale(0%);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav-links a {
    text-decoration: none;
    color: black;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.nav-links a:hover {
    text-decoration: underline;
}

/* Breadcrumb */
breadcrumb-nav {
    margin-bottom: 30px;
    padding: 10px 0;
}

.breadcrumb-container {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #888;
}

.breadcrumb-container a {
    text-decoration: none;
    color: #888;
    transition: color 0.2s;
}

.breadcrumb-container a:hover {
    color: #000;
    text-decoration: underline;
}

.breadcrumb-container span {
    color: #000;
}

.breadcrumb-container a::after {
    content: "/";
    margin: 0 10px;
    color: #ddd;
    display: inline-block;
}

/* Admin / Auth specific */
.logged-bar {
    height: 20px;
    background: var(--blue);
    padding: .5rem 0 .5rem .5rem;
    text-align: end;
}

.user-status {
    font-size: 0.75rem;
    color: var(--white);
    text-transform: uppercase;
    margin-right: 10px;
}

.user-status a {
    color: var(--white);
}

.admin-link {
    background: black;
    color: white !important;
    padding: 8px 15px;
    border: 1px solid black;
}

.admin-link:hover {
    background: white;
    color: black !important;
    text-decoration: none !important;
}

.login-btn, .logout-btn {
    border: 1px solid #ddd;
    padding: 8px 15px;
    font-size: 0.75rem !important;
    transform: rotate(0.000001deg);
}

/* --- BOUTON BACK TO TOP (Swiss Style) --- */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999; /* Toujours au dessus */
    width: 50px;
    height: 50px;
    background-color: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    
    /* État initial : caché et légèrement décalé vers le bas */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 8px 0px rgba(0,0,0,0.15);
}

/* État quand on scroll */
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: #333;
    transform: translateY(-5px);
    box-shadow: 12px 12px 0px rgba(0,0,0,0.1);
}

.back-to-top:active {
    transform: translateY(0);
}

/* Cacher à l'impression */
@media print {
    .back-to-top { display: none !important; }
}

/* ==========================================================================
   4. RECHERCHE & AUTOCOMPLETE
   ========================================================================== */

.search-section {
    margin-bottom: 50px; 
}

.search-container { 
    position: relative; 
    width: 100%; 
}

.search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    overflow: hidden;
}

#main-search, .ghost-text {
    width: 100%;
    padding: 15px;
    font-size: 1.5rem;
    font-family: 'Helvetica', sans-serif;
    border: 2px solid var(--black);
    background: transparent;
    line-height: 1.2;
    box-sizing: border-box;
}

#main-search {
    color: black;
    position: relative;
    z-index: 2;
}

.ghost-text {
    position: absolute;
    z-index: 1;
    color: #ccc;
    border-color: transparent;
    white-space: pre;
    pointer-events: none;
}

.autocomplete-box {
    position: absolute;
    background: white;
    width: 100%;
    border: 1px solid var(--black);
    border-top: none;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.suggestion-item { 
    padding: 10px; 
    cursor: pointer; 
    border-bottom: 1px solid var(--gray); 
}

.suggestion-item:hover { 
    background: var(--gray); 
}

.suggestion-item small {
    color: #888;
    text-transform: uppercase;
    font-size: 0.7rem;
}

/* ==========================================================================
   5. TABLEAUX & COMPOSANTS DE DONNÉES
   ========================================================================== */

.col-type   { width: 15%; }
.col-title  { width: 30%; }
.col-brand  { width: 25%; }
.col-tags   { width: 20%; }
.col-action { width: 10%; }

.swiss-table {
    width: 100%;
    border-collapse: collapse;
    /*margin-top: 50px;*/
    margin-bottom: 100px;
}

.swiss-table th {
    text-align: left;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding-bottom: 15px;
    border-bottom: 2px solid black;
}

.swiss-table td {
    padding: 20px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}

.swiss-table a:hover {
    color: #000;
}

.type-badge {
    font-size: 0.65rem;
    font-weight: bold;
    text-transform: uppercase;
    border: 1px solid black;
    padding: 2px 5px;
}

.type-badge.clickable-type {
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.type-badge.clickable-type:hover {
    background-color: #000;
    color: #fff;
    border-color: #000;
}

.view-btn {
    display: inline-block;
    padding: 6px 15px;
    background-color: var(--black);
    color: white;
    text-decoration: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: bold;
    border: 1px solid var(--black);
    transition: all 0.2s;
    margin-right: 5px;
    margin-bottom: 5px;
    transform: rotate(0.000001deg);
}

.view-btn:hover {
    background-color: white;
    color: var(--black);
}

.results-counter {
    padding: 20px 0;
    margin-bottom: 20px;
    font-weight: bold; 
    text-transform: uppercase; 
    font-size: 0.8rem; 
    letter-spacing: 0.05em;
}

/* ==========================================================================
   6. TAGS & PILLS
   ========================================================================== */

.tag {
    display: inline-block;
    background: #f0f0f0;
    padding: 2px 8px;
    margin-right: 5px;
    margin-bottom: 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.1s ease;
}

.tag:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

.tag-pill {
    display: inline-block;
    padding: 4px 10px;
    background: white;
    border: 1px solid #ddd;
    margin: 0 5px 5px 0;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-pill:hover {
    background: black;
    color: white;
    border-color: black;
}

.tag-pill.category {
    text-transform: uppercase;
    font-weight: bold;
    border-color: #bbb;
}

.tag-pill-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.tag-suggestions-container {
    margin-top: 10px;
    padding: 10px;
    background: #fcfcfc;
    border: 1px solid #eee;
}

.tag-suggestions-container small {
    display: block;
    font-size: 0.6rem;
    color: #888;
    margin-bottom: 5px;
    letter-spacing: 0.05em;
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    max-height: 3.2em; /* Limite à exactement 1 ligne (ajuster selon la taille de police) */
    overflow: hidden;
    position: relative;
}

/* ==========================================================================
   7. FORMULAIRES & ÉDITION
   ========================================================================== */

.contribute-container {
    margin: 0 auto; 
}
.swiss-form .form-group { 
    margin-bottom: 20px; 
}

.swiss-form label {
    display: block;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.swiss-form input[type="text"],
.swiss-form input[type="password"],
.swiss-form input[type="url"],
.swiss-form input[type="date"],
.swiss-form select,
.swiss-form textarea,
.edit-field {
    width: 100%;
    padding: 10px;
    border: 2px solid black;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.swiss-form input:focus {
    outline: none;
    background-color: #f9f9f9;
}

.required {
    color: #ff4d4f;
    font-weight: bold;
}

/* Mode Édition */
.edit-mode-active input, 
.edit-mode-active textarea, 
.edit-mode-active select {
    border: 2px solid var(--blue) !important;
    background: #fff;
    padding: 10px;
    width: 90%;
    margin-bottom: 10px;
    font-family: 'Courier New', Courier, monospace;
}

.edit-mode-active .content-body {
    border: 2px solid #0055ff;
    padding: 20px;
    background: #f0f7ff;
    margin-bottom: 20px;
}

#edit-description {
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 10px;
    border: 1px solid #0055ff;
    resize: vertical;
}

.edit-label {
    display: none;
    font-size: 0.6rem;
    color: var(--blue);
    font-weight: bold;
    margin-top: 10px;
}

.download-section {
    margin-top: 30px; 
    border-top: 1px solid #eee; 
    padding-top: 20px;
}

#display-slug::before {
    opacity: 0.4;
    font-weight: normal;
}

/* Masquer le label et le paragraphe du slug par défaut */
.slug-section {
    display: none;
}

/* Afficher uniquement quand on est en mode édition */
.edit-mode-active .slug-section {
    display: block;
}

/* Style optionnel pour différencier le slug des autres champs en édition */
.slug-section p {
    font-family: monospace;
    font-size: 0.8rem;
    color: #888;
    background: #f9f9f9;
    padding: 5px;
    border: 1px solid #eee;
    margin-bottom: 10px;
}

.edit-mode-active .edit-label { display: block; }
.editable-container.editing .view-mode { display: none !important; }
.editable-container.editing .edit-mode { display: block !important; margin: 10px 10px 0; }

/* Boutons d'action */
.save-style { 
    background: #000; 
    color: #fff; 
    border-color: #000; 
    width: 100%;
    margin-top: 5px;
    font-size: 0.7rem;
}

.save-style:hover { 
    background: #fff; 
    color: #000; 
}
.cancel-style { 
    background: #fff; 
    color: #ff4d4f; 
    border-color: #ff4d4f; 
    width: 100%;
    margin-top: 5px;
    font-size: 0.7rem;
}

.cancel-style:hover { 
    background: #ff4d4f; 
    color: #fff; 
}

.delete-style {
    color: var(--white);
    background-color: #CA0B00;
    border: 1px solid #CA0B00;
    width: 100%;
    margin-top: 5px;
    font-size: 0.7rem;
}

.delete-style:hover {
    background-color: var(--white);
    color: #CA0B00;
}

.admin-btn {
    display: inline-block;
    font-weight: bold;
    text-decoration: none;
    border: 1px solid var(--black);
    cursor: pointer;
    padding: 6px 15px;
    font-size: 0.75rem;
    text-transform: uppercase;
    transition: all 0.2s;
    margin-right: 5px;
    margin-bottom: 5px;
    transform: rotate(0.000001deg);
}

.edit-small {
    background: #f0f0f0;
    color: black;
}

.edit-small:hover {
    background: #0055ff;
    color: white !important;
    border-color: #0055ff; 
}

.delete-small {
    background: white;
    color: #ff0000;
    border-color: #ff0000;
}

.delete-small:hover { 
    background: #ff0000; 
    color: white; 
}

.download-style {
    width: 80%;
    text-align: center;
    padding: 12px;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.download-style:hover { text-decoration: none; }
.download-style svg { margin-top: -3px; }

/* Responsive YouTube Video */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* Ratio 16:9 */
    height: 0;
    overflow: hidden;
    margin: 20px 0;
    border: 1px solid #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Icons for the new editor buttons */
.fa-paragraph:before { content: "¶"; font-family: sans-serif; font-weight: bold; }

/* Image placeholder style in editor */
.EasyMDEContainer .cm-s-easymde .cm-image-marker {
    color: #0055ff;
    font-weight: bold;
}

/* ==========================================================================
   8. WIKI & GUIDES
   ========================================================================== */

.wiki-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    grid-template-areas: "content sidebar";
    gap: 40px;
}

.wiki-sidebar {
    grid-area: sidebar;
    background: #fcfcfc;
    padding: 20px;
    border: 1px solid #eee;
    height: fit-content;
}

.wiki-sidebar label {
    display: block;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #888;
    margin-top: 20px;
}

.wiki-content {
    grid-area: content;
    max-width: 850px;
}

.wiki-sidebar p {
    margin-top: 0.5rem;
    font-size: 0.9rem !important;
    }

.wiki-header h1 { 
    font-size: 3rem;
    margin-bottom: 10px; 
}

.wiki-header h2 { 
    font-size: 1.2rem;
    font-weight: 300;
    color: #666;
    margin-top: -5px; 
    text-transform: uppercase;
}

.wiki-header p {
    color: #666;
    font-size: 1rem;
    margin-top: -10px;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.main-content {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 40px;
}

.markdown-body {
    min-height: 100px; /* Évite que la page ne soit "plate" au chargement */
}

/* On cache le contenu brut s'il n'est pas encore traité par Python (sécurité) */
.markdown-body:empty {
    visibility: hidden;
}

.markdown-render h1, 
.markdown-render h2, 
.markdown-render h3 {
    font-family: var(--font-main);
    font-weight: 800; /* Poids fort type Swiss Design */
    color: #000;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.1;
    letter-spacing: -0.02em; /* Titres serrés pour le style moderne */
}

.markdown-render h1 {
    font-size: 2.2rem;
    text-transform: uppercase;
    border-bottom: 4px solid black;
    padding-bottom: 10px;
}

.markdown-render h2 {
    font-size: 1.6rem;
    text-transform: uppercase; /* Cohérence avec les labels du site */
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.markdown-render h3 {
    font-size: 1.2rem;
    text-transform: none; /* Pas de majuscules pour le H3 pour varier la hiérarchie */
    color: #333;
}

/* 3. Style du texte de lecture (Paragraphs, Lists) */
.markdown-render p, 
.markdown-render li {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #222;
    margin-bottom: 1.2rem;
}

/* 4. Cohérence avec la Sidebar (Table of Contents) */
.toc-item a {
    font-family: var(--font-main);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

/* --- LIENS DANS LE CONTENU (Markdown / Descriptions) --- */
.markdown-render a {
    font-weight: 700; /* Plus gras pour ressortir dans le texte */
    border-bottom: 1px solid #ddd; /* Une bordure au lieu d'un soulignement pour plus de finesse */
}

.markdown-render a:hover {
    border-bottom-color: #000;
    background-color: #f9f9f9; /* Léger fond au survol */
    text-decoration: underline;
    text-decoration-thickness: 2px; /* Soulignement épais style technique */
    text-underline-offset: 3px;
}

/* 5. Citations et Blocs de code (Style Wiki Technique) */
.markdown-render blockquote {
    margin: 20px 0;
    padding: 10px 20px;
    background: #f9f9f9;
    border-left: 5px solid black;
    font-style: italic;
}

.markdown-render code {
    background: #f0f0f0;
    padding: 2px 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.guide-info-box {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
    color: #555;
    border-top: 1px solid #eee;
    padding-top: 15px;
    font-size: 0.75rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.toc-item {
    margin-bottom: 8px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
}

.toc-item::after {
    content: "..................................................................................................................................................................................................................................";
    flex: 1;
    white-space: nowrap;
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.toc-item a {
    text-decoration: none;
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: color 0.2s;
}

.toc-item a:hover {
    color: #000;
    text-decoration: underline;
}

/* Hiérarchie visuelle */
.toc-h2 { font-weight: bold; margin-left: 10px; }
.toc-h3 { margin-left: 20px; }

/* Indicateur de section active (Optionnel pour le futur) */
.toc-item.active a {
    color: #000;
    font-weight: bold;
    border-left: 2px solid black;
    padding-left: 5px;
}

/* On s'assure que les ancres ne sont pas cachées par la navbar lors du scroll */
h1[id], h2[id], h3[id] {
    scroll-margin-top: 100px;
}

/* ==========================================================================
   9. ABOUT PAGE
   ========================================================================== */

.about-header {
    margin-bottom: 60px;
}

.about-header h1 { 
    font-size: 3rem;
    margin-bottom: 10px; 
}

.about-header h2 { 
    font-size: 1.2rem;
    font-weight: 300;
    color: #666;
    margin-top: -5px; 
    text-transform: uppercase;
}

.about-section {
    margin-bottom: 60px;
}

/* --- FILTER GRID --- */
.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 40px;
}

.filter-card {
    border: 1px solid #000;
    padding: 25px;
    position: relative;
    background: #fff;
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.05);
}

.filter-tag {
    position: absolute;
    top: -12px;
    left: 20px;
    background: #000;
    color: #fff;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
}

.filter-card h3 {
    margin-top: 5px;
    text-transform: uppercase;
    font-size: 1rem;
}

.example-code {
    display: block;
    background: #f4f4f4;
    padding: 10px;
    font-family: monospace;
    font-size: 0.9rem;
    margin-top: 15px;
    border-left: 3px solid var(--blue);
}

.filter-list {
    list-style: none;
    padding: 0;
    font-size: 0.85rem;
}

.filter-list li {
    margin-bottom: 5px;
}

/* --- SHORTCUTS --- */
.shortcut-item {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
}

kbd {
    background: #000;
    color: #fff;
    padding: 10px 15px;
    font-family: inherit;
    font-weight: 900;
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
}

.ui-element {
    border: 1px solid #000;
    padding: 10px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    background: #fff;
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
    .filter-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   10. IMAGES & ÉDITEUR
   ========================================================================== */

.image-gallery img {
    width: 100%;
    height: auto;
    border: 2px solid #000;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.05);
}

.brand-logo-container {
    width: 100%;
    margin-bottom: 20px;
    background: #fff;
    margin-top: 20px;
    position: relative;
    display: inline-block;
}

.brand-logo-container img {
    width: 100%;
    height: auto;
    border: 1px solid #000;
}

.no-image {
    width: 100%;
    height: 150px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #ccc;
    color: #999;
    text-transform: uppercase;
    font-weight: bold;
}

/* Le bouton de suppression (la croix) */
.remove-img-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: #ff4d4f;
    color: white;
    border: 2px solid #000;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: none; /* Caché par défaut */
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: transform 0.2s;
}

.remove-img-btn:hover {
    transform: scale(1.1);
    background: #000;
}

/* Affichage uniquement en mode édition */
.edit-mode-active .remove-img-btn {
    display: flex;
}

.upload-zone {
    background: #fffbe6;
    border: 2px dashed #ffe58f;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.upload-zone label {
    display: block;
    font-weight: bold;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.EasyMDEContainer {
    width: 100%;
    margin-top: 10px;
    background: white;
    border-radius: 0 !important;
}

.editor-toolbar {
    border-radius: 0 !important;
}

.CodeMirror {
    height: 500px !important; /* Hauteur fixe */
    min-height: 500px !important;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    border-radius: 0 !important;
    border: 2px solid #000 !important; /* Rappel du style Swiss */
}

/* On force le scroll interne si le contenu dépasse */
.CodeMirror-scroll {
    max-height: 500px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Ajustement pour la prévisualisation côte à côte (Side-by-side) */
.editor-preview-side {
    height: 500px !important;
    position: absolute !important;
}

/* Optionnel : Amélioration visuelle de la barre d'outils pour qu'elle reste propre */
.editor-toolbar {
    border: 2px solid #000 !important;
    border-bottom: none !important;
    background: #fff !important;
    opacity: 1 !important;
}

.editor-preview img, 
.markdown-render img, 
.main-guide-body img {
    max-width: 100%;
    height: auto;
    border: 1px solid #000;
    margin: 20px 0;
    display: block;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.05);
}

/* --- MANUAL VIEWER CONTAINER --- */
.manual-viewer {
    margin-top: 40px;
    background-color: #fff;
}

/* --- Suppression du viewer-controls --- */
.viewer-controls {
    display: none;
}

/* --- Ajustement du page-number --- */
.page-number {
    display: inline-block;
    background-color: #000;
    color: #fff;
    padding: 5px 12px;
    font-size: 0.7rem;
    font-weight: 800;
    margin-bottom: 15px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* --- ÉTAT VIDE --- */
.no-document {
    padding: 100px 0;
    text-align: center;
    border: 2px dashed #ddd;
    color: #999;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.1em;
}

.page-container {
    margin-bottom: 20px;
}

/* --- RESPONSIVITÉ --- */
@media (max-width: 768px) {
    .image-gallery {
        gap: 30px;
    }
    
    .page-container img {
        box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.05);
    }
}

/* --- OPTIMISATION PRINT --- */
@media print {
    .navbar, .wiki-sidebar, .viewer-controls, .breadcrumb-nav, .admin-panel {
        display: none !important;
    }
    
    .container, .wiki-grid, .wiki-content, .manual-viewer {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    .page-container {
        page-break-after: always;
        margin: 0 !important;
        box-shadow: none !important;
    }

    .page-container img {
        border: none !important;
        box-shadow: none !important;
    }
}

/* ==========================================================================
   11. FLASH MESSAGES & NOTIFICATIONS
   ========================================================================== */

#flash-container {
    position: fixed;
    top: 140px;
    left: 45%;
    transform: translateX(-50%); /* Centre le conteneur invisible */
    z-index: 10001;
    width: 100%;
    max-width: 1200px; /* Doit correspondre au max-width de votre .container */
    padding: 0 40px;   /* Doit correspondre au padding de votre .container */
    pointer-events: none;
    
    /* Aligne les messages flash à droite à l'intérieur de ce conteneur */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Style de chaque message */
.flash-message {
    pointer-events: auto; /* Réactive le clic pour le bouton fermer */
    background: #000;
    color: #fff;
    padding: 15px 25px;
    margin-bottom: 10px;
    border: 2px solid #000;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.15);
    
    /* Animation d'entrée */
    animation: slideDown 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* Couleurs selon la catégorie */
.flash-message.error {
    background: #ff4d4f; /* Rouge vif pour l'erreur */
    border-color: #ff4d4f;
}

.flash-message.success {
    background: #000; /* Noir pour le succès (Swiss style) */
}

/* Bouton fermer */
.flash-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: 15px;
    line-height: 1;
    opacity: 0.7;
}

.flash-close:hover {
    opacity: 1;
}

/* Animations */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* Container de la barre */
.progress-wrapper {
    display: none; /* Caché par défaut */
    margin: 20px 0;
    padding: 15px;
    background: #f4f4f4;
    border: 1px solid #000;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #ddd;
    position: relative;
}

#upload-progress-bar {
    width: 0%;
    height: 100%;
    background: #000; /* Style Swiss : noir uni */
    transition: width 0.1s linear;
}

/* Status de traitement (après l'upload) */
.processing-status {
    display: none;
    font-size: 0.8rem;
    color: #0055ff;
    font-weight: bold;
    animation: blink 1s infinite;
    margin-top: 10px;
}

@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   13. USER LOGIN, ADMIN AND ERRORS
   ============================================================ */

.userauth-container {
    margin: 0 auto;
    max-width: 500px;
    margin-top: 100px;
}

.userauth-container h1 {
    border-bottom: 2px solid black;
    padding-bottom: 10px;
}

.userauth-container .view-btn {
    width: 100%;
    height: 50px;
}

.error-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 60vh;
        text-align: center;
}

.error-code {
    font-size: 10rem;
    font-weight: 900;
    line-height: 1;
    margin: 0;
    letter-spacing: -0.05em;
    display: inline-block;
}

.error-details {
    margin-top: 40px;
    max-width: 500px;
}

.error-details h2 {
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
}

.error-details p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 40px;
}

/* Mobile adjust */
@media (max-width: 768px) {
    .error-code {
        font-size: 6rem;
    }
}

/* Badges de Statut */
.status-badge {
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 8px;
    border: 1px solid black;
    letter-spacing: 0.05em;
}

.status-badge.active {
    background-color: #000;
    color: #fff;
}

.status-badge.pending {
    background-color: #fff;
    color: #888;
    border-color: #ddd;
}

/* Selecteur Admin */
.admin-select {
    font-family: inherit;
    font-size: 0.8rem;
    padding: 4px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-weight: 600;
}

.admin-select:focus {
    border-color: #000;
    outline: none;
}

/* Mise en page table admin */
.admin-container .swiss-table td {
    vertical-align: middle;
}

.addmember-style {
    width: auto;
}

.input-email {
    height: 50px;
    width: 100%;
    padding: 10px;
    border: 2px solid black;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}

.admin-select:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
    border-color: #eee;
    color: #999;
}

.swiss-tabs { border-bottom: 2px solid #000; margin-bottom: 30px; display: flex; gap: 10px; }
.tab-link { background: none; border: none; padding: 10px 20px; font-weight: 900; text-transform: uppercase; cursor: pointer; color: #999; }
.tab-link.active { color: #000; border-bottom: 4px solid #000; margin-bottom: -2px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.roles-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.role-card { border: 1px solid #000; padding: 20px; background: #f9f9f9; }
.perm-item { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; font-size: 0.8rem; cursor: pointer; }
.perm-label { line-height: 1.2; }

.role-add-bar {
    background: #f4f4f4;
    padding: 20px;
    border: 1px solid #000;
    margin-bottom: 30px;
}

.role-card.locked {
    background-color: #fff;
    border: 2px solid #0055ff; /* Bleu pour signaler que c'est un rôle système */
}

.perm-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.perms-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.perm-label small {
    color: #666;
    display: block;
    line-height: 1.1;
}

/* ============================================================
   13. MOBILE RESPONSIVE - SWISS STYLE
   ============================================================ */

@media (max-width: 768px) {
    html {
        overflow-y: auto;
    }

    /* 1. Layout & Containers */
    .container {
        padding: 15px;
    }

    /* 2. Navbar Mobile */
    .nav-container {
        flex-direction: inherit;
        gap: 15px;
    }

    .nav-links {
        width: fit-content;
        flex-wrap: wrap;
        gap: 10px;
    }

    .nav-links a {
        font-size: 0.65rem;
    }
    
    .type-nav-link{
        display: none;
    }

    .user-status {
        display: inline-block;
    }

    /* 3. Search Engine (Index) */
    h1 {
        font-size: 2rem; /* Titre moins imposant sur mobile */
        margin-bottom: 20px;
    }

    #main-search, .ghost-text {
        font-size: 1.1rem;
        padding: 12px;
    }

    /* 4. Responsive Table (Index)
       On transforme le tableau en blocs empilés pour la lisibilité */
    .swiss-table thead {
        display: none; /* Cache les entêtes de colonnes */
    }

    .swiss-table, .swiss-table tbody, .swiss-table tr, .swiss-table td {
        display: block;
        width: 100%;
        margin-top: 0;
        border-top: 1.5px solid black;
    }

    .swiss-table tr {
        border-bottom: 3px solid black; /* Séparation forte entre les résultats */
        padding: 15px 0;
        position: relative;
    }

    .swiss-table td {
        padding: 5px 0;
        border: none;
        text-align: left;
    }

    /* Style spécifique pour chaque "cellule" devenue ligne */
    .swiss-table td:first-child {
        margin-bottom: 5px;
    }

    /* On force le bouton d'action à prendre plus de place ou être isolé */
    .swiss-table td:last-child {
        text-align: left;
        margin-top: 10px;
    }

    .view-btn {
        margin: 0;
    } 

    .admin-panel .view-btn {
        margin-bottom: 10px;
    }

    .admin-btn {
        margin: 0;
    } 

    /* 5. Wiki View Grid (Brand, Model, Sheet, Guide)
       Aside (Meta) passe au dessus du Content */
    .wiki-grid {
        display: block; /* Annule le grid-template-columns */
    }

    .wiki-sidebar {
        border-right: none;
        border-bottom: 2px solid #eee;
        padding-bottom: 30px;
        margin-bottom: 30px;
    }

    .wiki-header h1 {
        font-size: 1.8rem;
    }

    /* 6. Images & Gallery */
    .image-gallery img {
        box-shadow: 6px 6px 0px rgba(0,0,0,0.05); /* Ombre plus petite sur mobile */
    }

    .page-container {
        margin-bottom: 40px;
    }

    /* 7. Forms (Contribute) */
    .form-row {
        grid-template-columns: 1fr !important; /* Force une seule colonne pour les lignes de formulaire */
        gap: 0 !important;
    }

    /* 8. Breadcrumbs */
    .breadcrumb-container {
        font-size: 0.6rem;
        line-height: 1.5;
        display: flex;
        flex-wrap: wrap;
    }

    /* 9. Back to Top */
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
    }

    /* 10. EasyMDE (Editor) */
    .editor-toolbar {
        overflow-x: auto;
        white-space: nowrap;
        display: flex;
    }

    .roles-grid {
        grid-template-columns: 1fr;
    }
}