/* 
  Style.css
  Wiki "Ma Commune, Mon Équipe"
  Objectif: Design Premium, Confiance, Institutionnel, Mobile-first
*/

:root {
    /* LIGHT MODE - Inspired by the reference "Scented" image */
    --primary-color: #4a4036;
    /* Dark warm gray/brown for main text/headings */
    --primary-light: #7a6a5a;
    --primary-hover: #29241e;
    --accent-color: #201f1e;
    /* Soft taupe/beige accent */

    --bg-main: #faf9f6;
    /* Very light warm cream/off-white */
    --bg-panel: #ffffff;
    /* Pure white for cards */
    --bg-sidebar: rgba(245, 243, 238, 0.92);
    /* Slightly transparent cream for sidebar */
    --bg-search: #ffffff;
    --bg-banner: #e8e3dc;
    /* Like the image banner */

    --text-main: #332f2a;
    /* Soft dark gray/brown */
    --text-muted: #33312e;
    /* Muted taupe */
    --text-light: #ffffff;

    --border-color: #e6e2da;
    --border-light: #f0ebe4;

    /* Sage Theme Palette - Darkened for absolute WCAG AA compliance */
    --sage-bg: #3e4b41;
    --sage-dark: #2d382f;
    --sage-text: #ffffff;
    --faq-bg: #f5f6f1;
    /* Light bone/greenish tint for FAQ */

    --shadow-sm: 0 2px 8px rgba(74, 64, 54, 0.04);
    --shadow-md: 0 8px 24px rgba(74, 64, 54, 0.08);
    --shadow-lg: 0 16px 32px rgba(74, 64, 54, 0.12);

    --radius-lg: 16px;
    /* Slightly softer corners */
    --radius-md: 8px;
    --radius-sm: 4px;

    --sidebar-width: 440px;
    /* Wider, elegant sidebar */
    --nav-height-mobile: 68px;
    --top-bar-height: 72px;
    --placeholder-color: #4a4036;
}



[data-theme="dark"] {
    /* DARK MODE - Adapting the soft, warm tones for dark mode */
    --primary-color: #f3f1ef;
    /* Warm off-white for headings */
    --primary-light: #c0b3a0;
    --primary-hover: #ffffff;
    --accent-color: #f3f1ef;
    /* Warmer gold/taupe accent */

    --bg-main: #24221f;
    /* Very dark warm gray/brown */
    --bg-panel: #2e2b27;
    --bg-sidebar: rgba(31, 29, 26, 0.92);
    --bg-search: #3d3934;
    --bg-banner: #36322d;

    --text-main: #f3f1ef;
    /* Soft cream text */
    --text-muted: #f3f1ef;
    --text-light: #1f1d1a;

    --border-color: #403c37;
    --border-light: #2e2b27;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.6);

    /* Dark Sage */
    --sage-bg: #3d4a42;
    --sage-dark: #2a332d;
    --sage-text: #f3f1ef;
    --faq-bg: #2a2c28;
    --placeholder-color: #f3f1ef;
}

::placeholder {
    color: var(--placeholder-color);
}

[data-theme="dark"] .header-logo {
    filter: invert(1) brightness(1.2);
}

/* Global Reset */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}

/* Global Scrollbar styling - Minimalist and Premium */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* Skip link (Accessibility) */
.skip-link {
    position: absolute;
    top: -100px;
    left: 24px;
    background: var(--primary-color);
    color: var(--text-light);
    padding: 12px 24px;
    z-index: 9999;
    border-radius: 0 0 8px 8px;
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    font-weight: 500;
    box-shadow: var(--shadow-md);
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
}

/* Consistent focus visibility (A11y) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.settings-trigger-btn:focus-visible {
    outline: 2px solid var(--accent-color) !important;
    outline-offset: 4px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
.decorative-title {
    font-family: 'Fraunces', serif;
    color: var(--primary-color);
}

html,
body,
.app-layout {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    margin: 0;
}

.app-layout {
    display: flex;
    flex-direction: column;
}




/* --- 2. LAYOUT: TOP BAR & SIDEBAR --- */

/* Top Bar - Always Visible */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 72px;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1100;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.top-bar-main {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 24px;
    height: 72px;
}

.top-bar-left {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.top-bar-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.top-bar-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.top-brand {
    border-bottom: none !important;
    padding: 0 !important;
}

.nav-toggle-btn {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--primary-color);
    transition: all 0.2s;
    border-radius: 8px;
}

.nav-toggle-btn:hover {
    background-color: var(--bg-search);
}

.hamburger-container {
    width: 20px;
    height: 14px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger-container span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-open .hamburger-container span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

body.sidebar-open .hamburger-container span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

body.sidebar-open .hamburger-container span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.nav-label {
    display: inline-block;
    margin-left: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--primary-color);
    letter-spacing: 0.5px;
}



/* Breakpoint 1100px pour la recherche et menu */
.d-desktop-large {
    display: inline-block !important;
}

.d-mobile-small {
    display: none !important;
}

@media (max-width: 1100px) {
    .d-desktop-large {
        display: none !important;
    }

    .d-mobile-small {
        display: flex !important;
    }
}

/* Fix desktop search positioning and clear button */
.top-bar-search.d-desktop-large .search-box {
    margin: 0;
    width: 340px;
    position: relative;
}

.top-bar-search.d-desktop-large .search-box input {
    height: 40px;
    font-size: 0.9rem;
    padding: 0 40px 0 40px;
    background-color: var(--bg-search);
    border: 1px solid var(--border-color);
}

.top-bar-search.d-desktop-large .search-box input:focus::placeholder {
    color: transparent;
}



#close-menu-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--primary-color);
    transition: transform 0.2s;
}

#close-menu-btn:hover {
    transform: scale(1.1) rotate(90deg);
}

/* Main content area */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--top-bar-height);
    background-color: var(--bg-main);
    min-height: calc(100vh - var(--top-bar-height));
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Sidebar - Toggable */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: var(--top-bar-height);
    /* Below top bar */
    left: 0;
    height: calc(100vh - var(--top-bar-height));
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transform: translateX(-100%);
    /* Hidden by default */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    overscroll-behavior: contain;
}

body.sidebar-open .sidebar {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 900;
    display: none;
    backdrop-filter: blur(2px);
}

body.sidebar-open .sidebar-overlay {
    display: block;
}



.search-expand-row {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--bg-panel);
    padding: 0 24px;
    width: 100%;
}

.search-expand-row.active {
    max-height: 80px;
    opacity: 1;
    padding: 12px 24px 20px 24px;
}

.search-expand-row .search-box {
    max-width: 800px;
    margin: 0 auto;
}

.top-bar-settings {
    position: relative;
}

.settings-trigger-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 280px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    display: none;
    z-index: 1200;
}

.settings-dropdown.active {
    display: block;
    animation: dropdownFadeIn 0.2s ease-out;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.settings-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.toggle-switch-btn {
    width: 44px;
    height: 24px;
    background-color: var(--border-color);
    border-radius: 12px;
    position: relative;
    border: none;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-switch-btn.active {
    background-color: var(--sage-bg);
}

.toggle-switch-btn .switch {
    width: 18px;
    height: 18px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: 0.3s;
}

.toggle-switch-btn.active .switch {
    left: 23px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: var(--bg-search);
}

/* Theme Icons Logic */
[data-theme="light"] .moon-icon {
    display: block;
}

[data-theme="light"] .sun-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: none;
}

[data-theme="dark"] .sun-icon {
    display: block;
}

/* Base Sidebar (Vertical Mode) */


.sidebar .sidebar-brand {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar .search-container {
    padding: 16px 24px;
}

.sidebar .toc-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    overscroll-behavior: contain;
}

.sidebar .sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    /* gap: 16px; */
}

/* Settings Menu visibility */
.settings-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- 3. SEARCH BOX STYLES --- */
.search-container {
    padding: 24px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: opacity 0.2s;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    /* Position on RIGHT now */
    width: 26px;
    height: 26px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
    border-radius: 50%;
    transition: all 0.2s;
}

.search-clear-btn:hover {
    background-color: var(--bg-search);
    color: var(--primary-color);
}

.search-clear-btn svg {
    width: 16px;
    height: 16px;
}

.searching .search-clear-btn {
    display: flex;
}

.search-box input {
    width: 100%;
    height: 44px;
    background-color: var(--bg-search);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0 40px 0 44px;
    /* Added space on RIGHT for the cross */
    border-radius: 22px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 64, 54, 0.05);
    background-color: var(--bg-panel);
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-brand {
    padding: 0;
}

.header-logo {
    height: 32px;
    /* Taille fixe pour éviter l'effet géant au chargement */
    width: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

/* --- SEARCH HINTS & MOBILE FIXES --- */
.search-hint {
    display: none;
    /* Cache par défaut, géré par JS lors de la frappe */
}

.sidebar-footer {
    padding: 40px 64px 60px;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.sidebar-footer .credit-label {
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--primary-light);
    margin-bottom: 8px;
    font-weight: 700;
}

.sidebar-footer .credit-brand {
    font-size: 14px;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    display: block;
    margin-bottom: 12px;
    transition: color 0.2s;
}

.sidebar-footer .credit-brand:hover {
    color: var(--accent-color);
}

.sidebar-footer .credit-copyright {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 25px;
    font-weight: 500;
}

.admin-badge-sidebar {
    display: inline-block;
    padding: 4px 8px;
    background-color: #c53030;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 4px;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.sidebar-footer .credit-contact {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    font-family: inherit;
}

.sidebar-footer .credit-contact:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-panel);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.sidebar-footer .credit-contact svg {
    width: 16px;
    height: 16px;
    color: var(--primary-light);
}

@media (max-width: 1100px) {
    .search-expand-row.active {
        max-height: 180px;
        /* Plus d'espace pour le hint mobile */
    }

    #search-hint-mobile {
        display: none;
        /* Cache par défaut, géré par JS */
        flex-direction: row;
        font-size: 0.8rem !important;
        margin: 12px 0 0 0 !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .sidebar-footer {
        padding: 24px 24px 30px;
        margin-top: 20px;
    }

    .sidebar-footer .credit-copyright {
        margin-bottom: 15px;
    }

    .admin-badge-sidebar {
        margin-bottom: 10px;
    }

    .toc-link {
        padding-top: 8px;
        padding-bottom: 8px;
        font-size: 0.9rem;
    }

    .toc-chapter-link {
        padding-top: 10px;
        padding-bottom: 10px;
    }
}

.brand-text h2 {
    font-size: 1.2rem;
    line-height: 1.2;
    margin: 0;
    font-weight: 700;
}

.brand-text span {
    font-size: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.d-mobile {
    display: none;
}

/* Search Box */
.search-container {
    padding: 24px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    background-color: var(--bg-search);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 16px 10px 40px;
    border-radius: var(--radius-lg);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(138, 124, 107, 0.15);
}

[data-theme="dark"] .search-box input:focus {
    box-shadow: 0 0 0 2px rgba(181, 164, 143, 0.2);
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}

.search-clear-btn:hover {
    color: var(--text-main);
    background: var(--border-color);
}

.hidden-by-search {
    display: none !important;
}

mark {
    background: #ffe066;
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* TOC Navigation */
.toc-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 16px 24px 64px;
    /* Marge généreuse à gauche pour décoller du bord */
}

.toc-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    border-left: none;
    /* Sécurité */
}

/* ScrollSpy Line Decorator */
.toc-nav ul::before {
    content: '';
    position: absolute;
    left: 21px;
    /* Axe central absolu */
    top: 8px;
    bottom: 8px;
    width: 2px;
    background-color: var(--border-color);
    border-radius: 2px;
    transform: translateX(-50%);
}

.toc-link {
    display: block;
    padding: 10px 16px 10px 36px;
    /* Increased left padding for more margin between text and dot */
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background-color 0.2s;
    position: relative;
}

.toc-link::before {
    content: '';
    position: absolute;
    left: 21px;
    /* Axe central absolu */
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--bg-sidebar);
    border: 2px solid var(--border-color);
    transition: border-color 0.2s, background-color 0.2s;
    z-index: 2;
}

.toc-link:hover {
    color: var(--text-main);
    background-color: var(--bg-search);
}

.toc-link.active {
    color: var(--primary-color);
    font-weight: 600;
    background-color: var(--bg-panel);
    box-shadow: var(--shadow-sm);
}

.toc-link.active::before {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

/* Chapter TOC Styling */
.toc-chapter-item {
    list-style: none;
}

.toc-chapter-link {
    display: block;
    padding: 12px 16px 12px 36px;
    font-family: 'Fraunces', serif;
    font-weight: 800;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent-color);
    text-decoration: none;
    position: relative;
    transition: color 0.2s;
}

.toc-chapter-link::before {
    content: '';
    position: absolute;
    left: 21px;
    /* Axe central absolu */
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--bg-sidebar);
    border: 2px solid var(--border-color);
    transition: border-color 0.2s, background-color 0.2s;
    z-index: 3;
}

.toc-chapter-link:hover {
    color: var(--primary-color);
}

.toc-chapter-link.active {
    color: var(--primary-color);
}

.toc-chapter-link.active::before {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

/* Sidebar Footer Theme switch Desktop */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.theme-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.theme-toggle-btn:hover {
    color: var(--text-main);
}

.toggle-switch {
    width: 40px;
    height: 20px;
    background-color: var(--bg-search);
    border-radius: 10px;
    position: relative;
    transition: background-color 0.3s;
    border: 1px solid var(--border-color);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.3s;
}

.theme-toggle-btn.active .toggle-switch {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.theme-toggle-btn.active .toggle-switch::after {
    transform: translateX(20px);
    background-color: white;
}

/* Main Content - Pushed by Sidebar */
.main-content {
    flex-grow: 1;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    min-height: calc(100vh - var(--top-bar-height));
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Sidebar Push Logic on Desktop */
@media (min-width: 1101px) {
    body.sidebar-open .main-content {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }

    body.sidebar-open .sidebar-overlay {
        display: none !important;
    }

    .header-logo {
        height: 32px;
    }

    .brand-text h2 {
        font-size: 1.8rem;
    }
}

.content-wrapper {
    flex: 1 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.hero-banner {
    background-color: var(--bg-banner);
    padding: 100px 48px;
    text-align: center;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 1000px;
    margin: 0 auto;
}

.hero-collection {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
    margin-bottom: 16px;
}

.decorative-title {
    font-size: 3.5rem;
    line-height: 1.15;
    margin-bottom: 32px;
    font-weight: 500;
    color: var(--text-main);
}

.hero-btn {
    display: inline-block;
    padding: 12px 32px;
    border: 1px solid var(--text-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    background-color: transparent;
}

.hero-btn:hover {
    background-color: var(--text-main);
    color: var(--bg-banner);
}

.no-results {
    background-color: var(--bg-panel);
    padding: 40px;
    text-align: center;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    margin-bottom: 40px;
}

/* Wiki Sections */
.wiki-section {
    margin-bottom: 64px;
    scroll-margin-top: 48px;
    /* Offset for internal linking */
}

/* Underline decoration for section titles */
.section-title {
    font-size: 2.2rem;
    margin-bottom: 16px;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}

.section-title span {
    color: var(--accent-color);
    font-size: 1.8rem;
}

.chapter-main-divider .chapter-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.7;
    margin-bottom: 12px;
}

.chapter-main-divider h2.title-text {
    margin: 0;
    font-size: 2.8rem;
    color: white;
    font-family: 'Fraunces', serif;
    font-weight: 700;
    line-height: 1.1;
}

/* Category Header (Full Width & Clean) */
.category-banner {
    background-color: var(--sage-bg);
    padding: 100px 48px;
    /* High padding for premium look */
    margin-bottom: 0;
    width: 100%;
    color: var(--sage-text);
}

.banner-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.category-number {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    opacity: 0.85;
    margin-bottom: 16px;
    color: var(--sage-text);
}

.category-title {
    font-family: 'Fraunces', serif;
    font-size: 3.8rem;
    /* Larger title for full page */
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--sage-text);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.section-intro {
    font-size: 16px;
    line-height: 1.8;
    max-width: 800px;
    margin: 0 auto;
    color: var(--sage-text) !important;
    text-align: center;
}

.section-intro p {
    margin-bottom: 0;
}

.category-body {
    max-width: 1200px;
    /* Wider container for flex grid */
    margin: 0 auto;
    padding: 80px 40px 0 40px;
}

.articles-list {
    display: flex;
    flex-direction: row;
    /* Flex row as requested */
    flex-wrap: wrap;
    gap: 32px;
    margin-bottom: 80px;
}

.wiki-article {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    flex: 0 1 calc(50% - 16px);
    /* Fixed 2-column layout, won't grow to full width if alone */
    min-width: 320px;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    scroll-margin-top: 100px;
    display: flex;
    flex-direction: column;
}

.wiki-article:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--sage-bg);
}

.wiki-article.hidden-by-search {
    display: none !important;
}

.article-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.article-meta-info {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-sidebar);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    gap: 12px;
    align-self: flex-end;
    /* Align number to the right */
}

.article-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
    display: flex;
}

.article-number {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-color);
    letter-spacing: 0.05em;
}

.article-title-text {
    font-family: 'Fraunces', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.2;
}

.article-body {
    margin-bottom: 24px;
    flex-grow: 1;
}

.article-footer {
    margin-top: auto;
    padding-top: 0;
    /* Remove top padding */
    border-top: none;
    /* Remove horizontal line */
}

/* FAQ Section (Block Style) */
.section-faq {
    background-color: var(--faq-bg);
    padding: 64px 48px;
    border-radius: var(--radius-lg);
    margin-top: 60px;
    display: block;
    border: none;
    /* Clean look */
}

.faq-main-title {
    font-family: 'Fraunces', serif;
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 0px !important;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.faq-item {
    background: transparent;
    border: none !important;
    margin-bottom: 4px;
    box-shadow: none !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.faq-question-header {
    padding: 24px 0;
    background: transparent;
}

.article-body p {
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.6;
}

.article-body>*:first-child {
    margin-top: 0;
}

.article-body>*:last-child {
    margin-bottom: 0;
}

.article-body ul {
    margin-left: 24px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.article-body li {
    margin-bottom: 8px;
}

.reference-links {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    background-color: var(--bg-main);
    border-radius: var(--radius-md);
    border-left: none;
    animation: slideDown 0.3s ease;
}

.reference-links.show {
    display: flex;
}

h3.ref-link-trigger {
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin: 2px -10px;
}

.ref-link-trigger:hover {
    background-color: var(--bg-search);
    color: var(--accent-color) !important;
}

.ref-link-trigger:hover .link-title,
.ref-link-trigger:hover .link-prefix {
    color: var(--accent-color) !important;
}

.reference-link-single.ref-link-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
}

.reference-link-item.ref-link-trigger {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.reference-link-item i {
    margin-top: 2px;
    flex-shrink: 0;
}

.link-prefix {
    color: var(--text-muted);
    font-weight: 400;
}

.link-title {
    color: var(--text-main);
    font-weight: 500;
}

/* FAQ Accordion */
.section-faq,
.faq-section {
    margin-top: 48px;
    margin-inline: auto;
    max-width: 1120px;
    padding: 60px 130px;
    background-color: var(--bg-panel);
    /* Match the panel background */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.faq-main-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: var(--text-main);
    font-family: 'Fraunces', serif;
}

.faq-main-title svg {
    color: var(--accent-color);
    width: 24px;
    height: 24px;
}

.faq-list {
    display: flex;
    flex-direction: column;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    cursor: pointer;
    gap: 16px;
}

.faq-question-text {
    margin-bottom: 0;
    font-size: 16px;
    color: var(--text-main);
    font-weight: 410;


    transition: color 0.3s;
    line-height: 1.4;
}

.faq-question-text p {
    display: block;
    margin: 0;
    /* font: inherit; */
    font-family: 'Fraunces', serif;
    font-size: 18px;
    color: inherit;
    font-weight: 400;

}

/* Force les balises strong/b à être de poids normal dans les questions FAQ */
.faq-question-text strong,
.faq-question-text b {
    font-weight: 520;
}



.faq-chevron {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.faq-answer-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-answer-text {
    padding-bottom: 20px;
    color: var(--text-main);
    line-height: 1.7;
    font-size: 16px;
}

.faq-answer-text p {
    margin-bottom: 12px;
}

.faq-answer-text p:last-child {
    margin-bottom: 0;
}


/* Active State */
.faq-item.active h4 {
    color: var(--primary-color);
}

.faq-item.active .faq-chevron {
    transform: rotate(180deg);
    color: var(--accent-color);
}

.faq-item.active .faq-answer-container {
    max-height: 1000px;
    /* Sufficient height for content */
}

.article-links {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.article-links.show {
    display: flex;
}

.read-more-toggle {
    all: unset;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    margin-top: 14px;
    padding: 4px 0;
    border-bottom: 1px dashed var(--border-color);
    transition: color 0.2s, border-color 0.2s;
    letter-spacing: 0;
    text-transform: none;
}

.read-more-toggle:hover {
    color: var(--primary-color);
    border-color: var(--accent-color);
}

.read-more-toggle:after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    margin-top: -2px;
    transition: transform 0.3s;
}

.read-more-toggle.active:after {
    transform: rotate(-135deg);
    margin-top: 2px;
}

/* Bullet Points Fix */
.ql-editor ul,
.ql-editor ol {
    padding-left: 1.5em !important;
}

.ql-editor li {
    padding-left: 0.1em !important;
    margin-bottom: 8px;
}

.article-content-text p {
    /* margin-bottom: 15px; */
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 0 0 64px 0;
}

.page-footer {
    padding: 64px 0 48px;
    margin-top: auto;
    background-color: var(--bg-banner);
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-info p {
    margin: 0;
}

.footer-logo-link {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 2px;
}

.legal-link {
    color: var(--text-muted);
    font-weight: bold;
    text-decoration: none;
    transition: color 0.2s;
}

.legal-link:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
    color: var(--primary-color);
}

.footer-separator {
    color: var(--border-color);
    opacity: 0.5;
}

/* Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 0;
    color: var(--text-muted);
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-panel);
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 1px solid var(--border-color);
}

.modal.show .modal-content {
    transform: translateY(0) scale(1);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.close-btn:hover {
    color: var(--text-main);
}

.modal-content h2 {
    font-size: 1.5rem;
    padding: 24px 32px 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-body {
    padding: 32px;
    font-size: 1rem;
    color: var(--text-muted);
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 32px;
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    text-align: right;
}

.btn {
    padding: 8px 24px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

[data-theme="dark"] .btn-primary {
    color: var(--text-light);
}

/* Mobile & Responsive Logic */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
    opacity: 0;
    transition: opacity 0.3s;
}

@media (max-width: 1100px) {
    .top-bar-main {
        padding: 0 12px;
    }

    .top-bar-right {
        gap: 4px;
    }

    .main-content {
        margin-left: 0 !important;
        margin-top: var(--top-bar-height);
        padding-top: 0 !important;
        transition: margin-top 0.3s ease;
    }

    .top-bar.search-active+.sidebar {
        top: var(--top-bar-height) !important;
        height: calc(100vh - var(--top-bar-height)) !important;
    }

    .decorative-title {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }

    .chapter-main-divider h2.title-text {
        font-size: 30px;
    }

    .category-title {
        font-size: 2.0rem;
        margin-bottom: 16px;
    }

    .chapter-main-divider,
    .category-banner {
        padding: 50px 24px !important;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .wiki-section {
        scroll-margin-top: calc(var(--nav-height-mobile) + 16px);
    }

    .hero-banner {
        padding: 60px 24px;
    }

    .category-banner {
        padding: 60px 24px;
    }

    .category-title {
        font-size: 30px;
    }

    .category-body {
        padding: 40px 20px 0 20px;
    }

    .wiki-article {
        flex: 1 1 100%;
        /* Full width on mobile/tablet */
        padding: 24px;
    }

    .faq-section,
    .section-faq {
        padding: 40px 20px;
        margin-top: 40px;
    }

    .section-conclusion {
        padding: 40px 20px !important;
        width: 95% !important;
        margin: 40px auto !important;
    }

    .page-footer {
        padding: 40px 24px 60px;
        margin-top: auto;
        text-align: center;
    }

    .footer-content {
        gap: 16px;
    }

    .footer-editor {
        margin-top: 8px;
    }
}

/* Admin In-Place Editing Styles */
#admin-mode-toggle.active .toggle-switch {
    background-color: #28a745;
}

#admin-mode-toggle.active .toggle-switch::before {
    transform: translateX(20px);
}

.footer-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 6px 0;
    opacity: 0.6;
}

.admin-edit-toolbar {
    display: none;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 8px;
}

.admin-mode-on .admin-edit-toolbar {
    display: flex;
}

.admin-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-color);
    background: white !important;
    color: #1a1a1a !important;
    transition: all 0.2s;
}

.admin-btn:hover {
    background: var(--bg-search);
}

.admin-btn-save {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.admin-btn-save:hover {
    background: #218838;
}

.admin-btn-cancel {
    background: var(--bg-card);
}

/* Highlight editable area when admin mode is on */
.admin-mode-on .wiki-section {
    border: 1px dashed transparent;
    transition: border-color 0.3s, background-color 0.3s;
    border-radius: var(--radius-lg);
    padding: 10px;
    margin-left: -10px;
    margin-right: -10px;
}

.admin-mode-on .wiki-section:hover {
    border-color: var(--primary-color);
}

.editing-active {
    border: 1px solid var(--primary-color) !important;
    background: var(--bg-card) !important;
    box-shadow: var(--shadow-lg);
}

.editing-active .ql-toolbar {
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    border-color: var(--border-color);
}

/* Magic Mode Modal */
.magic-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeInMagic 0.2s ease;
}

@keyframes fadeInMagic {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.magic-modal-inner {
    background: var(--bg-panel);
    /* FIXED: Use defined --bg-panel instead of non-existent --bg-card */
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpMagic 0.25s ease;
}

@keyframes slideUpMagic {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.magic-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.magic-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
}

.magic-modal-title svg {
    color: var(--primary-color);
}

.magic-modal-actions {
    display: flex;
    gap: 8px;
}

.magic-modal-hint {
    padding: 12px 20px;
    background: var(--bg-search);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 1.6;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.magic-modal-hint code {
    background: var(--border-color);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.magic-modal-editor {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-panel);
}

.magic-modal-editor .ql-toolbar {
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-search);
    flex-shrink: 0;
}

.magic-modal-editor .ql-container {
    border: none;
    flex: 1;
    overflow-y: auto;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    background: var(--bg-panel);
}

.magic-modal-editor .ql-editor {
    min-height: 360px;
    padding: 20px 24px;
    color: var(--text-main);
}

.editing-active .ql-container {
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    border-color: var(--border-color);
}

/* Reference Modal Styles (Premium Look) */
.wiki-ref-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(46, 43, 39, 0.7);
    /* Deep warm overlay */
    backdrop-filter: blur(12px);
    z-index: 2000000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.wiki-ref-modal.show {
    display: flex;
}

.wiki-ref-modal-content {
    background: var(--bg-panel);
    border-radius: 20px;
    width: 100%;
    max-width: 760px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleUp {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.wiki-ref-modal .modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

#modal-title {
    padding: 28px 32px 20px;
    font-family: 'Fraunces', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.01em;
}

.wiki-ref-modal .modal-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-sidebar);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.wiki-ref-modal .close-btn {
    position: absolute;
    top: -15px;
    right: 15px;
    font-size: 2rem;
    background: var(--bg-search);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    padding-bottom: 4px;
}

.wiki-ref-modal .close-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

/* Specific Law Text styling */
.law-text-display {
    background: #fdfcf9;
    /* Slightly yellowish paper tone */
    padding: 24px 32px;
    border-radius: 12px;
    border-left: none;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-main);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.03);
    font-weight: 400;
}

.law-text-display p {
    margin-bottom: 0;
}

.law-text-display h2,
.law-text-display h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-family: 'Fraunces', serif;
}

.law-text-display ul,
.law-text-display ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

[data-theme="dark"] .law-text-display {
    background: #2a2723;
    color: #ddd;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Modal Buttons */
.wiki-ref-modal .btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.wiki-ref-modal .btn-primary {
    background: var(--primary-color);
    /* color: white; */
    border: none;
}

.wiki-ref-modal .btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.wiki-ref-modal .btn-secondary {
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    background: transparent;
}

.wiki-ref-modal .btn-secondary:hover {
    background: var(--accent-color);
    color: var(--bg-search);
}

[data-theme="dark"] .wiki-ref-modal .btn-secondary:hover {
    color: #000000;
}

/* --- 6. SEARCH FILTERING --- */
/* Hide extra elements when searching */
main.searching .hero-banner,
main.searching .content-wrapper>.faq-section {
    display: none !important;
}

/* Strict hiding of unmatched items */
.wiki-section.hidden-by-search,
.wiki-article.hidden-by-search,
.faq-item.hidden-by-search,
.glossary-item.hidden-by-search {
    display: none !important;
}

/* ==========================================================================
   GLOSSARY / LEXIQUE STYLES
   ========================================================================== */
.lexique-section {
    margin-top: 60px;
    padding-top: 20px;
}

.lexique-banner {
    background: #fdfcf9 !important;
    border-left: 6px solid var(--accent-color);
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.glossary-item {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.glossary-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}

.glossary-header {
    padding: 18px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel);
}

.glossary-term {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.01em;
}

.glossary-item.active .glossary-header {
    background: #fdfcf9;
    border-bottom: 1px solid var(--border-light);
}

.glossary-answer {
    padding: 0 25px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-panel);
}

.glossary-item.active .glossary-answer {
    padding: 20px 25px;
    max-height: 2000px;
}

.glossary-definition {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-main);
}

.glossary-item .faq-chevron {
    color: var(--accent-color);
    transition: transform 0.3s ease;
}

.glossary-item.active .faq-chevron {
    transform: rotate(180deg);
}

/* Contact Form Styles */
.form-group-contact {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.form-group-contact label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    padding-left: 2px;
}

.form-group-contact input,
.form-group-contact textarea {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group-contact input:focus,
.form-group-contact textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(138, 124, 107, 0.1);
}

.contact-btn {
    text-decoration: none !important;
    cursor: pointer;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--primary-color) !important;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.85rem !important;
    transition: all 0.3s ease;
    border-radius: var(--radius-sm);
    margin: 8px 0;
}

.contact-btn:hover {
    /* background-color: var(--primary-color) !important; */
    background-color: #f6f4ee !important;
    color: rgb(0, 0, 0) !important;
    border-color: var(--primary-color);
}

#contact-status.error {
    color: #d93025;
    background: #fdf2f2;
    padding: 10px;
    border-radius: var(--radius-sm);
}

#contact-status.success {
    color: #1e7e34;
    background: #f2fdf5;
    padding: 10px;
    border-radius: var(--radius-sm);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Cookie Banner - Premium Look */
.cookie-banner {
    position: fixed;
    bottom: 24px;
    left: 24px;
    right: 24px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    max-width: 580px;
    margin: 0 auto;
    animation: cookieSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cookie-content p {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-main);
    margin: 0;
}

.cookie-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

@keyframes cookieSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Classes par défaut pour desktop */
.d-desktop {
    display: inline;
}

.d-mobile {
    display: none;
}

@media (max-width: 600px) {

    /* Classes d'affichage conditionnel mobile */
    .d-desktop {
        display: none !important;
    }

    .d-mobile {
        display: inline !important;
    }

    /* Correction largeur sidebar mobile */
    .sidebar {
        width: 85vw !important;
        max-width: 300px !important;
    }

    .cookie-banner {

        bottom: 12px;
        left: 12px;
        right: 12px;
        padding: 20px;
    }

    /* Réduction des marges spécifiques mobile */
    .hero-banner {
        padding: 40px 16px;
    }

    .category-banner {
        padding: 40px 16px !important;
    }

    .category-body {
        padding: 24px 12px 0 12px;
    }

    .wiki-article {
        padding: 16px;
        margin-bottom: 16px;
    }

    .faq-section,
    .section-faq {
        padding: 24px 12px;
        margin-top: 24px;
    }

    .section-conclusion {
        padding: 24px 16px !important;
        margin: 24px auto !important;
    }

    /* Optimisation maximale des marges de la modale */
    .wiki-ref-modal {
        padding: 8px !important;
        /* Laisse peu d'espace avec les bords de l'écran */
    }

    .wiki-ref-modal-content {
        border-radius: 12px;
        max-height: 95vh;
    }

    #modal-title {
        padding: 16px 12px 10px 12px !important;
        font-size: 1.4rem !important;
    }

    .wiki-ref-modal .modal-body {
        padding: 16px 12px !important;
    }

    .wiki-ref-modal .modal-footer {
        padding: 16px 12px !important;
        border-bottom-left-radius: 12px;
        border-bottom-right-radius: 12px;
    }

    .wiki-ref-modal .close-btn {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
    }
}




/* Navigation Flottante Groupée */
.floating-nav-group {
    position: fixed;
    bottom: 32px;
    right: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.floating-nav-group.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-floating-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--text-light);
    border: none;
    box-shadow: 0 8px 16px rgba(74, 64, 54, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-floating-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: 0 10px 20px rgba(74, 64, 54, 0.3);
}

.nav-floating-btn i {
    width: 22px;
    height: 22px;
}

@media (max-width: 600px) {
    .floating-nav-group {
        bottom: 20px;
        right: 20px;
        gap: 8px;
    }

    .nav-floating-btn {
        width: 44px;
        height: 44px;
    }
}

/* --- RESPONSIVE CHAPTER TITLES --- */
.chapter-main-divider {
    grid-column: 1 / -1;
    margin: 0;
    background: #4f6157;
    padding: 60px 48px;
    color: white;
    width: 100%;
    box-sizing: border-box;
}

.chapter-title-container {
    max-width: 900px;
    margin: 0 auto;
    text-align: left;
}

.chapter-label-text {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.8;
    margin-bottom: 12px;
}

.chapter-title-heading {
    font-family: 'Fraunces', serif;
    font-size: 3rem;
    margin: 0;
    line-height: 1.1;
    color: white;
}

@media (max-width: 768px) {
    .chapter-main-divider {
        padding: 40px 24px;
    }

    .chapter-title-heading {
        font-size: 2rem;
    }
}

/* --- FAQ HEADER & BUTTON PREMIUM --- */
.faq-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.faq-main-title {
    margin: 0 !important;
}

.faq-btn-premium {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.faq-btn-premium:hover {
    border-color: var(--accent-color);
    background: var(--bg-main);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.faq-btn-premium i {
    width: 16px;
    height: 16px;
}

@media (max-width: 1100px) {
    .faq-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .faq-btn-premium {
        width: fit-content;
    }
}

/* Breadcrumb Styling */
.breadcrumb-nav {
    display: block;
    margin-bottom: 25px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    /* Max contrast for accessibility */
}

.breadcrumb-nav span,
.breadcrumb-nav a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-nav a:hover {
    color: var(--primary-color);
}

.breadcrumb-nav .breadcrumb-separator {
    margin: 0 8px;
    color: var(--text-muted);
    /* Darker for accessibility audit */
}

.breadcrumb-nav .breadcrumb-current {
    font-weight: 600;
    color: var(--text-main);
}

/* Category banner always needs white breadcrumb for contrast */
.category-banner .breadcrumb-nav {
    color: #ffffff;
}

.category-banner .breadcrumb-nav .breadcrumb-current,
.category-banner .breadcrumb-nav .breadcrumb-separator {
    color: #ffffff;
}

/* No results Premium State */
.no-results-premium {
    padding: 80px 20px;
    text-align: center;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin: 40px 0;
    box-shadow: var(--shadow-md);
    animation: fadeInSearchResult 0.4s ease-out;
}

.no-results-content h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.no-results-content p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.no-results-icon {
    margin-bottom: 30px;
    color: var(--border-color);
    opacity: 0.6;
}

.btn-clear-search {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-clear-search:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

@keyframes fadeInSearchResult {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}