/* --- Polices & Variables --- */
@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&family=Exo+2:wght@800&display=swap");

:root {
    --font-heading: 'Exo 2', sans-serif;
    --font-body: 'Roboto Mono', monospace;
    --color-bg: #1e1e1e;
    --color-surface: #2d2d2d;
    --color-text: #e0e0e0;
    --color-text-muted: #a0a0a0;
    --color-pink: #ff5e5e;
    --color-cyan: #8a8aff;
    --color-border: #444444;
    --shadow-glow: 0 0 15px color-mix(in srgb, var(--color-pink) 30%, transparent);
    --border-radius: 4px;
}

/* --- Styles Généraux --- */
body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    margin: 0;
    font-size: 16px;
    background-image: url("https://www.transparenttextures.com/patterns/low-contrast-linen.png");
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.content-wrapper {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

a {
    color: var(--color-cyan);
    text-decoration: none;
    transition: all 0.2s ease;
    text-shadow: 0 0 5px var(--color-cyan);
}

a:hover {
    color: #ffffff;
    text-shadow: 0 0 10px var(--color-cyan);
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--color-text);
    margin-top: 0;
    text-transform: uppercase;
}

img {
    max-width: 100%;
    display: block;
}

/* --- Header & Footer --- */
.main-header {
    background-color: var(--color-surface);
    border-bottom: 2px solid var(--color-border);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--color-pink);
    text-shadow: 0 0 8px var(--color-pink);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-image {
    height: 40px;
    image-rendering: pixelated;
}

.main-nav a {
    margin-left: 2rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.main-footer {
    background: var(--color-surface);
    border-top: 2px solid var(--color-border);
    padding: 2rem;
    margin-top: 3rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.footer-links {
    margin-bottom: 1rem;
}

.footer-links a {
    margin: 0 1rem;
    color: var(--color-text-muted);
    text-shadow: none;
}
.footer-links a:hover {
    color: var(--color-cyan);
}

/* --- Boutons --- */
.button {
    font-family: var(--font-body);
    font-weight: 700;
    text-transform: uppercase;
    padding: 10px 20px;
    border: 2px solid var(--color-pink);
    color: var(--color-pink);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: inset 0 0 5px var(--color-pink), 0 0 5px var(--color-pink);
    display: inline-block;
    text-shadow: none;
}

.button:hover {
    background-color: var(--color-pink);
    color: var(--color-surface);
    box-shadow: inset 0 0 10px #000, 0 0 20px var(--color-pink);
    text-shadow: none;
}

/* --- Hero Banner --- */
/* La bannière du moteur est une balise <img> sans classe : affichée au-dessus du titre */
.hero-banner {
    position: relative;
    min-height: 250px;
    box-sizing: border-box;
    padding: 1.5rem;
    border: 2px solid var(--color-border);
    background-color: var(--color-bg);
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.hero-banner > img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--color-border);
    box-shadow: 0 0 12px color-mix(in srgb, var(--color-pink) 25%, transparent);
}

.hero-overlay {
    position: relative;
    z-index: 2;
    max-width: 100%;
    box-sizing: border-box;
    padding: 1rem 2rem;
    background: radial-gradient(circle, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 70%);
}

.hero-overlay h1 {
    font-size: clamp(1.15rem, 3vw, 2.2rem);
    color: #fff;
    text-shadow: 0 0 10px var(--color-pink), 2px 2px 0px var(--color-border);
    margin: 0;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

/* --- Fil d'Ariane (Breadcrumb) --- */
.breadcrumb {
    padding: 0.8rem 1rem;
    background-color: var(--color-surface);
    border-left: 4px solid var(--color-cyan);
    margin-bottom: 2rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-item {
    color: var(--color-text-muted);
    text-shadow: none;
}

.breadcrumb-item:hover {
    color: var(--color-cyan);
}

.breadcrumb-separator {
    color: var(--color-pink);
    font-weight: bold;
}

/* --- Cartes Générales --- */
.card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

/* --- FORUM LIST (Page d'accueil) --- */
.forum-section {
    margin-bottom: 2rem;
}

.forum-header {
    background: linear-gradient(90deg, var(--color-surface) 0%, var(--color-bg) 100%);
    border-bottom: 2px solid var(--color-border);
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--color-cyan);
    display: inline-block;
    min-width: 200px;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

.forum-item {
    display: grid;
    /* Grid layout: Avatar | Subject | Author | Stats | Last Msg */
    grid-template-columns: 60px minmax(0, 1fr) 150px 110px 180px;
    gap: 1rem;
    align-items: center;
    background-color: color-mix(in srgb, var(--color-surface) 50%, var(--color-bg));
    border: 1px solid var(--color-border);
    margin-bottom: -1px; /* Collapsed borders */
    padding: 1rem;
    transition: background-color 0.2s, transform 0.1s;
}

.forum-item:hover {
    background-color: var(--color-surface);
    border-color: var(--color-cyan);
    z-index: 10;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.forum-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    object-fit: cover;
}

.forum-subject {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    text-shadow: none;
    line-height: 1.3;
}

.forum-subject:hover {
    color: var(--color-cyan);
}

.forum-author,
.forum-messages, 
.forum-last-message {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.forum-author a {
    color: var(--color-pink);
    text-shadow: none;
}

.forum-last-message {
    text-align: right;
    font-size: 0.75rem;
    opacity: 0.8;
}

.forum-subject,
.forum-author {
    min-width: 0;
    overflow-wrap: anywhere;
}

.forum-messages {
    white-space: nowrap;
}

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

/* Responsive Forum List : sujet sur toute la largeur, infos méta chacune dans sa cellule */
@media (max-width: 900px) {
    .forum-item {
        grid-template-columns: 48px minmax(0, 1fr) auto auto;
        column-gap: 1rem;
        row-gap: 0.4rem;
    }
    .forum-avatar {
        grid-column: 1;
        grid-row: 1 / span 2;
    }
    .forum-subject {
        grid-column: 2 / -1;
        grid-row: 1;
    }
    .forum-author,
    .forum-messages,
    .forum-last-message {
        grid-row: 2;
        font-size: 0.75rem;
    }
    .forum-author { grid-column: 2; }
    .forum-messages { grid-column: 3; }
    .forum-last-message {
        grid-column: 4;
        white-space: nowrap;
    }
}

@media (max-width: 600px) {
    .forum-item {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        column-gap: 0.75rem;
        padding: 0.85rem;
    }
    .forum-avatar {
        grid-row: 1 / span 3;
        align-self: start;
        width: 40px;
        height: 40px;
    }
    .forum-subject {
        font-size: 1rem;
    }
    .forum-last-message {
        grid-column: 2 / -1;
        grid-row: 3;
        text-align: left;
        white-space: normal;
    }
    .forum-header {
        font-size: 1.25rem;
        min-width: 0;
    }
}

/* --- THREAD VIEW (Sujets) --- */
/* Note: Le DOM a un style inline display: flex, on l'utilise */
.card[style*="display: flex"] {
    gap: 1.5rem;
    align-items: flex-start;
}

.post-author {
    width: 160px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-right: 1px solid var(--color-border);
    height: 100%;
}

.author-avatar {
    width: 100px;
    height: 100px;
    border: 2px solid var(--color-pink);
    padding: 4px;
    margin-bottom: 1rem;
    background-color: #000;
}

.post-author a {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    text-shadow: none;
}

.post-author a strong {
    color: var(--color-pink);
    font-family: var(--font-heading);
    letter-spacing: 1px;
    font-size: 1.1rem;
    text-shadow: 0 0 6px color-mix(in srgb, var(--color-pink) 45%, transparent);
}

.post-body {
    flex-grow: 1;
    min-width: 0;
    padding: 0.5rem 1rem;
    overflow-wrap: anywhere;
}

.post-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    border-bottom: 1px dashed var(--color-border);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.post-body p {
    margin-bottom: 1rem;
    font-size: 1rem;
    white-space: pre-line; /* Conserve les retours à la ligne des messages */
}

/* Contenu des messages : images, vidéos intégrées, blocs de code */
.post-body img,
.post-body video,
.post-body iframe {
    max-width: 100%;
}

.post-body img,
.post-body video {
    height: auto;
}

.post-body iframe {
    height: auto;
    aspect-ratio: 16 / 9;
}

.post-body pre {
    white-space: pre-wrap;
}

/* Titre du fil et de la page catégorie */
.content-wrapper > h1 {
    overflow-wrap: anywhere;
}

/* Responsive Thread */
@media (max-width: 768px) {
    .card[style*="display: flex"] {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .card > .post-author {
        width: auto;
        box-sizing: border-box;
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        justify-content: flex-start;
        gap: 1rem;
        height: auto;
        padding: 0.5rem;
        text-align: left;
    }
    .author-avatar {
        width: 50px;
        height: 50px;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .card > .post-body {
        padding: 0 0.25rem;
    }
}

/* --- USER PROFILE (Profil) --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem;
}

.profile-avatar {
    width: 150px;
    height: 150px;
    flex-shrink: 0;
    object-fit: cover;
    border: 4px solid var(--color-cyan);
    box-shadow: 0 0 15px var(--color-cyan);
}

.profile-info {
    flex-grow: 1;
    min-width: 0;
}

.profile-info h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: var(--color-cyan);
    text-shadow: 0 0 10px var(--color-cyan);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.profile-stats ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 1.5rem;
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border: 1px solid var(--color-border);
}

.profile-stats li {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.profile-stats span {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-pink);
    font-family: var(--font-heading);
    line-height: 1;
}

/* Listes d'activités dans le profil */
.card h3 {
    border-bottom: 2px solid var(--color-pink);
    display: inline-block;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.card > div {
    /* Cible les items de listes (threads/comments) qui sont des divs directs dans .card */
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.card > div:last-child {
    border-bottom: none;
}

.comment-date {
    font-size: 0.8rem;
    color: var(--color-cyan);
    margin-bottom: 0.25rem;
    font-family: var(--font-heading);
}

.comment-thread-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.comment {
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-left: 3px solid var(--color-border);
    font-style: italic;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* Profil : derniers sujets et réponses (balisage généré par Forum.php) */
.comment-thread-title,
.comment {
    overflow-wrap: anywhere;
}

.comment {
    white-space: pre-line; /* Conserve les retours à la ligne, comme dans le fil */
}

.comment img,
.comment video,
.comment iframe {
    max-width: 100%;
    height: auto;
}

.comment iframe {
    aspect-ratio: 16 / 9;
}

.comment pre {
    white-space: pre-wrap;
}

/* --- Formulaires --- */
.reply-form h3 {
    margin-bottom: 1rem;
    color: var(--color-cyan);
}

form {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.form-input {
    width: 100%;
    padding: 1rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-family: var(--font-body);
    margin-bottom: 1rem;
    box-sizing: border-box; /* Important pour ne pas dépasser */
    resize: vertical;
    min-height: 100px;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-cyan);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    gap: 0.5rem;
}

/* Ajustements visuels mineurs */
strong {
    color: var(--color-text);
}

/* Fil d'Ariane long, pagination vide du fil */
.breadcrumb {
    flex-wrap: wrap;
    overflow-wrap: anywhere;
}

.pagination:not(:has(*)) {
    display: none;
}

/* --- Mobile --- */
@media (max-width: 900px) {
    .header-content {
        flex-wrap: wrap;
        gap: 0.75rem 1.5rem;
    }
    .logo {
        flex: 1 1 100%;
        min-width: 0;
        font-size: 1.4rem;
        gap: 0.75rem;
    }
    .logo span {
        min-width: 0;
        overflow-wrap: anywhere;
    }
    .main-nav {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem 1.5rem;
    }
    .main-nav a {
        margin-left: 0;
    }
}

@media (max-width: 600px) {
    .main-header {
        position: static;
        padding: 0.25rem 0;
    }
    .container {
        padding: 1rem;
    }
    .logo {
        font-size: 1.15rem;
        line-height: 1.3;
    }
    .main-nav {
        gap: 0.5rem 1rem;
    }
    .main-nav .button {
        padding: 6px 12px;
    }
    .breadcrumb {
        margin-bottom: 1.25rem;
    }
    .hero-banner {
        min-height: 0;
        padding: 1rem;
        margin-bottom: 1.25rem;
    }
    .hero-overlay {
        padding: 0.75rem 1rem;
    }
    .content-wrapper {
        margin-top: 1rem;
    }
    .content-wrapper > h1 {
        font-size: 1.35rem;
    }
    .card {
        padding: 1rem;
    }
    .main-footer {
        padding: 1.5rem 1rem;
        overflow-wrap: anywhere;
    }
    .footer-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1.5rem;
    }
    .footer-links a {
        margin: 0;
    }
    .card > .profile-header {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 0.5rem 0;
    }
    .profile-avatar {
        width: 100px;
        height: 100px;
        border-width: 3px;
    }
    .profile-info h1 {
        font-size: 1.8rem;
    }
    .profile-stats ul {
        gap: 1rem 2rem;
        margin-top: 1rem;
    }
    .profile-activity h3 {
        margin-bottom: 1rem;
    }
    .profile-activity > div {
        padding: 0.85rem 0;
    }
    .comment-thread-title {
        font-size: 1rem;
    }
    .comment {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}
