:root {
    /* --- Variables Injectées --- */
    --font-main: 'Inter', sans-serif;
    --color-bg: #F2F7FA;
    --color-text: #0B3954;
    --color-text-muted: #567385;
    --color-accent: #FF6B6B;
    --color-accent-hover: #FF8484;
    --color-border: #E0EAF0;
    --color-surface: #FFFFFF;
    --color-text-inverted: #FFFFFF;
    --color-on-accent: #0A344D;
    --color-surface-translucent: rgba(255, 255, 255, 0.5);
    --color-breadcrumb-tag: rgba(0, 0, 0, 0.03);
    --color-shadow: rgba(0, 0, 0, 0.1);
    --hero-overlay-color: rgba(11, 57, 84, 0.5);
    --profile-shape-color: rgba(255, 107, 107, 0.1);
    
    /* --- Variables Design System --- */
    --radius-soft: 16px;
    --radius-pill: 50px;
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

/* =========================================
   RESET & BASES
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--color-bg);
    color: var(--color-text);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Texture de fond */
.background-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('https://www.transparenttextures.com/patterns/recycled-paper.png');
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
}

a { text-decoration: none; color: inherit; transition: all 0.3s ease; }
img { max-width: 100%; display: block; }

/* Conteneur principal */
.container, .main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================================
   HEADER & NAVIGATION
   ========================================= */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: var(--color-surface-translucent);
    backdrop-filter: blur(10px);
    border-bottom: 1px dashed var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--color-text);
    min-width: 0;
}
.logo img { height: 36px; width: auto; flex-shrink: 0; }
.logo span { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }

.main-nav { display: flex; gap: 30px; flex-shrink: 0; }

.nav-link {
    font-weight: 600;
    color: var(--color-text-muted);
    position: relative;
    padding: 5px 0;
    white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: var(--color-text); }

/* Indicateur actif */
.nav-link.active::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--color-accent);
    border-radius: 50%;
    margin: 4px auto 0;
}

.cta-button {
    background-color: var(--color-accent);
    color: var(--color-on-accent);
    padding: 10px 24px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    box-shadow: var(--shadow-soft);
    white-space: nowrap;
    flex-shrink: 0;
}
.cta-button:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-2px);
}

/* =========================================
   HERO SECTION (HOME)
   ========================================= */
.hero {
    position: relative;
    text-align: center;
    padding: 80px 20px;
    margin: 40px 0 60px;
    /* Forme organique "Oeil" / "Feuille" */
    border-radius: 50% 50% 50% 50% / 60% 65% 40% 45%;
    overflow: hidden;
    color: var(--color-text-inverted);
    background-color: var(--color-accent);
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow-soft);
}

@media (min-width: 768px) {
    .hero { border-radius: 45% 55% 60% 40% / 65% 50% 50% 35%; }
}

.hero__overlay {
    position: absolute;
    inset: 0;
    background-color: var(--hero-overlay-color);
}

.hero__content {
    position: relative;
    z-index: 2;
    max-width: 700px;
    margin: 0 auto;
    /* Halo de la couleur du voile : texte lisible sur une bannière claire ou sombre */
    text-shadow: 0 1px 2px var(--hero-overlay-color), 0 0 18px var(--hero-overlay-color);
}
.hero__content h1 { font-size: 3rem; font-weight: 800; margin-bottom: 10px; line-height: 1.1; }
.hero__content p { font-size: 1.2rem; opacity: 0.95; }

/* Breadcrumb */
.breadcrumb { margin: 20px 0; font-size: 0.9rem; color: var(--color-text-muted); }
.breadcrumb-item:hover { color: var(--color-accent); text-decoration: underline; }
.breadcrumb-separator { margin: 0 6px; }

/* =========================================
   PAGE D'ACCUEIL : LES BULLES ORGANIQUES
   ========================================= */
/* Balisage généré par Forum.php : .forum-section > a > h2.forum-header + .forum-item
   (avatar, sujet, auteur, nombre de messages, dernier message), accueil et page catégorie. */

/* Catégorie sans fil : masquée sur l'accueil */
.forum-section:has(> a > .forum-header):not(:has(.forum-item)) { display: none; }

/* Grille des bulles */
.forum-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px; /* Espace large pour respirer */
    margin-bottom: 60px;
    
    background: transparent;
    border: none;
    padding: 0;
}

/* Titre de la catégorie */
.forum-section > a {
    grid-column: 1 / -1;
    margin-bottom: 10px;
    background: transparent;
    border: none;
    padding: 0 10px;
}

.forum-header {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

/* --- L'ITEM "BULLE" --- */
.forum-item {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 3rem 2rem;
    min-height: 250px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    box-shadow: var(--shadow-soft);
    z-index: 1;
}

/* Variations de formes (Blobs) */
.forum-item:nth-child(4n+1) { border-radius: 50% 50% 50% 50% / 60% 65% 40% 45%; }
.forum-item:nth-child(4n+2) { border-radius: 60% 40% 50% 50% / 50% 50% 60% 40%; }
.forum-item:nth-child(4n+3) { border-radius: 40% 60% 30% 70% / 60% 30% 70% 40%; }
.forum-item:nth-child(4n+4) { border-radius: 45% 55% 55% 45% / 55% 45% 40% 60%; }

/* Effet Hover */
.forum-item:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-hover);
    z-index: 10;
    background-color: var(--color-surface);
}

/* Contenu de la bulle */
.forum-item > * { max-width: 100%; min-width: 0; overflow-wrap: anywhere; }

.forum-avatar {
    order: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 3px var(--color-bg);
    margin-bottom: 14px;
    flex-shrink: 0;
}

.forum-subject {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--color-text);
    margin-bottom: 20px;
    order: 1;
}
.forum-subject:hover { text-decoration: underline; }

.forum-author {
    order: 3;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-top: auto;
}
.forum-author a:hover { text-decoration: underline; }

.forum-messages {
    order: 4;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 5px;
}
.forum-messages::before { content: "• "; margin-right: 5px; }

.forum-last-message {
    order: 5;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* =========================================
   PAGE PROFIL (USER) - HEADER PRESERVÉ
   ========================================= */
/* --- PAGE USER & FORMULAIRES --- */
.profile-header {
    position: relative;
    text-align: center;
    padding: 4rem 2rem;
    margin-bottom: 4rem;
    border-radius: 45% 55% 60% 40% / 65% 50% 50% 35%;
    overflow: hidden;
    background-color: var(--color-surface-translucent);
    border: 1px solid var(--color-border);
}

.profile-header__shape {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    background-color: var(--profile-shape-color);
    border-radius: 68% 32% 57% 43% / 44% 52% 48% 56%;
    transform: translate(-50%, -50%);
    animation: morph 12s infinite ease-in-out alternate;
    z-index: 1;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--color-surface);
    box-shadow: 0 5px 15px var(--color-shadow);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.profile-name {
    font-size: 2.5rem;
    font-weight: 800;
    position: relative;
    z-index: 2;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.profile-meta { color: var(--color-text-muted); font-weight: 600; margin-top: 0.25rem; position: relative; z-index: 2; }

.profile-stats {
    display: flex; justify-content: center; gap: 1rem;
    margin-top: 1.5rem; font-weight: 600;
    position: relative; z-index: 2;
}
.stat-separator { width: 1px; height: 16px; background-color: var(--color-border); }

/* --- SECTION ACTIVITÉ (Category-Section Refaite) --- */
.category-section {
    margin-bottom: 60px;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px dashed var(--color-border);
    color: var(--color-text);
}

.thread-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* On style les divs d'activité comme des cartes propres (pas de blobs ici) */
.thread-list > div {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 25px;
    border-radius: var(--radius-soft);
    transition: transform 0.2s ease, border-color 0.2s;
    position: relative;
    overflow: hidden;
    overflow-wrap: anywhere;
}

/* Petite barre colorée au survol */
.thread-list > div::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; 
    background: var(--color-border); transition: 0.2s;
}

.thread-list > div:hover {
    transform: translateY(-3px);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-soft);
}
.thread-list > div:hover::before { background: var(--color-accent); }

.comment-date {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.comment-thread-title a {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}
.comment-thread-title a:hover { color: var(--color-accent); }

.comment {
    margin-top: 15px;
    font-style: italic;
    color: var(--color-text-muted);
    line-height: 1.6;
    padding-left: 15px;
    border-left: 2px solid var(--color-border);
}

/* =========================================
   PAGE THREAD (POSTS)
   ========================================= */
.thread-page-title {
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    margin: 40px 0 50px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.post-list { display: flex; flex-direction: column; gap: 30px; }

.post-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-soft);
    padding: 30px;
    display: flex;
    gap: 30px;
}

.post-author {
    flex-shrink: 0; width: 140px; text-align: center;
    border-right: 1px dashed var(--color-border); padding-right: 20px;
}
.author-avatar {
    width: 80px; height: 80px; border-radius: 50%; margin-bottom: 10px;
    border: 3px solid var(--color-bg);
}
.author-name { display: block; font-weight: 700; color: var(--color-text); margin-bottom: 5px; overflow-wrap: anywhere; }
.author-role {
    display: inline-block;
    font-size: 0.75rem; color: var(--color-on-accent);
    text-transform: uppercase; font-weight: 700; letter-spacing: 1px;
    background: var(--color-accent); padding: 4px 10px; border-radius: 12px;
}

.post-content { flex-grow: 1; min-width: 0; overflow-wrap: anywhere; }
.post-content a { text-decoration: underline; }
.post-content img, .post-content video { height: auto; }
.post-content iframe, .post-content video, .post-content embed { display: block; max-width: 100%; margin: 15px 0; }
.post-content iframe { height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; }
.post-content pre { white-space: pre-wrap; }
.post-date {
    font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 15px;
    border-bottom: 1px dotted var(--color-border); padding-bottom: 10px; display: block;
}

/* =========================================
   PAGE CATÉGORIE
   ========================================= */
.hero-simple { text-align: center; margin: 30px 0 40px; }
.hero-simple h1 { font-size: 2.2rem; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.hero-simple p { color: var(--color-text-muted); margin-top: 8px; }

/* Le titre de la catégorie est déjà dans .hero-simple */
.organic-grid > .forum-section > a { display: none; }

.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 0 20px; }
.pagination .current-page, .pagination .page-link {
    min-width: 40px; padding: 8px 14px; text-align: center; font-weight: 700;
    border-radius: var(--radius-pill); border: 1px solid var(--color-border);
}
.pagination .current-page { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.pagination .page-link { background: var(--color-surface); color: var(--color-text); }
.pagination .page-link:hover { border-color: var(--color-accent); }

/* =========================================
   FOOTER & ANIMATIONS
   ========================================= */
.site-footer {
    text-align: center; padding: 40px 0; margin-top: 60px;
    border-top: 1px dotted var(--color-border);
}
.site-footer .logo { justify-content: center; font-size: 1.4rem; margin-bottom: 15px; padding: 0 20px; text-align: left; }
.site-footer p { color: var(--color-text-muted); font-size: 0.9rem; padding: 0 20px; }

.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-top: 20px; }
.footer-nav a { color: var(--color-text-muted); font-weight: 600; }
.footer-nav a:hover { color: var(--color-text); }

@keyframes morph {
    0% { border-radius: 68% 32% 57% 43% / 44% 52% 48% 56%; }
    100% { border-radius: 35% 65% 62% 38% / 54% 41% 59% 46%; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
    .site-header { padding: 16px 20px; gap: 20px; }
    .main-nav { gap: 20px; }
}

/* Mobile : logo et bouton sur une ligne, menu en dessous */
@media (max-width: 768px) {
    .site-header {
        position: relative; flex-wrap: wrap; padding: 12px 16px; gap: 10px 16px; margin-bottom: 10px;
    }
    .site-header .logo { flex: 1 1 0; font-size: 1.15rem; gap: 10px; }
    .site-header .logo img { height: 32px; }
    .cta-button { padding: 8px 18px; font-size: 0.9rem; }
    .main-nav { order: 3; width: 100%; justify-content: center; gap: 20px; font-size: 0.9rem; }
    .nav-link { padding: 2px 0; }

    .main-content { padding: 0 16px; }
    .hero { padding: 50px 24px; margin: 20px 0 40px; }
    .hero__content h1 { font-size: 2rem; }
    .hero__content p { font-size: 1rem; }

    .forum-header { font-size: 1.6rem; }

    /* On simplifie les bulles sur mobile pour gagner de la place */
    .forum-section { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 40px; }
    .forum-section > a { padding: 0; }
    .forum-item { border-radius: 20px !important; padding: 26px 20px; min-height: auto; }
    .forum-subject { font-size: 1.1rem; margin-bottom: 14px; }

    .thread-page-title { font-size: 1.6rem; margin: 20px 0 30px; }
    .hero-simple { margin: 20px 0 30px; }
    .hero-simple h1 { font-size: 1.6rem; }

    .post-list { gap: 20px; }
    .post-item { flex-direction: column; padding: 20px; gap: 0; }
    .post-author {
        width: 100%; border-right: none; border-bottom: 1px dashed var(--color-border);
        padding: 0 0 16px; margin-bottom: 16px;
        display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; text-align: left;
    }
    .author-avatar { width: 56px; height: 56px; margin: 0; }
    .author-name { margin: 0; min-width: 0; }

    .profile-header { padding: 3rem 1.5rem; margin-bottom: 3rem; }
    .profile-name { font-size: 1.8rem; }
    .thread-list > div { padding: 20px; }
}

@media (max-width: 480px) {
    .site-header .logo { font-size: 1.05rem; }
    .hero__content h1 { font-size: 1.7rem; }
    .forum-header, .thread-page-title { font-size: 1.4rem; }
    .site-footer .logo { font-size: 1.15rem; }
}