/* --- VARIABLES & INITIALISATION --- */
:root {
  --font-header: 'Cinzel', serif;
  --font-body: 'Montserrat', sans-serif;
  --radius: 0;
  --color-bg: #1c1d21;
  --color-surface: #282a2f;
  --color-text: #e0dcd3;
  --color-text-header: #ffffff;
  --color-accent: #f76d1e;
  --color-accent-rgb: 247, 109, 30;
  /* Accent lisible sur la surface des cartes (≥ 4,5:1) */
  --color-accent-text: #f76d1e;
  --color-muted: #818286;
  --color-overlay: rgba(0, 0, 0, 0.6);
  --color-shadow: rgba(0, 0, 0, 0.8);
  --color-separator: #444548;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--color-accent);
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

h1, h2, h3 {
    font-family: var(--font-header);
    font-weight: 700;
    color: var(--color-text-header);
    letter-spacing: 2px;
}

/* --- STRUCTURE PRINCIPALE --- */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 3rem;
}

/* --- HEADER & FOOTER --- */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-accent);
  margin-bottom: 1.5rem;
}

.logo {
  font-family: var(--font-header);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--color-accent);
}
.logo:hover {
    color: var(--color-text-header);
}

.main-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
  font-family: var(--font-header);
  font-weight: 700;
  letter-spacing: 1px;
}

.button {
  border: 2px solid var(--color-accent);
  padding: 10px 20px;
  color: var(--color-accent);
  transition: background-color 0.2s, color 0.2s;
}
.button:hover {
  background-color: var(--color-accent);
  color: var(--color-bg);
}

.main-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--color-accent);
}

.footer-brand {
    color: var(--color-accent);
    font-family: var(--font-header);
    letter-spacing: 2px;
    white-space: nowrap;
}

.footer-nav {
    display: flex;
    gap: 2rem;
    font-family: var(--font-header);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.footer-nav a {
    color: var(--color-muted);
}
.footer-nav a:hover {
    color: var(--color-accent);
}


/* --- CONTENU PRINCIPAL --- */
.breadcrumb {
    padding: 1.5rem 0;
    font-family: var(--font-body);
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--color-muted);
    text-transform: uppercase;
}
.breadcrumb a {
    color: var(--color-muted);
}
.breadcrumb a:hover {
    color: var(--color-accent);
}

.hero-banner {
  position: relative;
  padding: 5rem 3rem;
  margin-bottom: 3rem;
  text-align: center;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  border: 1px solid var(--color-accent);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    background-image: 
        linear-gradient(45deg, rgba(212, 175, 55, 0.1) 25%, transparent 25%), 
        linear-gradient(-45deg, rgba(212, 175, 55, 0.1) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(212, 175, 55, 0.1) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(212, 175, 55, 0.1) 75%);
    background-size: 20px 20px;
    z-index: 1;
}

/* Texte toujours clair : le voile de la bannière est sombre sur toutes les palettes */
.hero-content {
    position: relative;
    z-index: 2;
    color: #ffffff;
}

.hero-content h1 {
  font-size: 3.5rem;
  margin: 0 0 1rem 0;
  color: #ffffff;
  text-shadow: 0 0 15px rgba(0,0,0,0.8);
}

.hero-content p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 0 8px rgba(0,0,0,0.8);
}

/* --- MODULES (Nouvelle Disposition) --- */
.main-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.sidebar-modules {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.module {
    background-color: var(--color-surface);
    border: 1px solid var(--color-accent);
    padding: 1.5rem;
}

.module-header {
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-accent);
  text-align: center;
}
.module-header h2 {
  font-size: 1.2rem;
}

.thread-list li {
    padding: 0.75rem 0;
    border-bottom: 1px dotted #333;
}
.thread-list li:last-child {
    border-bottom: none;
}
.thread-list li span {
    color: var(--color-muted);
    margin-right: 0.75rem;
    font-size: 0.9rem;
}

.category-list li a {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px dotted #333;
    font-weight: 600;
}
.category-list li:last-child a {
    border-bottom: none;
}
.category-list a:hover {
    background-color: var(--color-accent);
    color: var(--color-bg);
}

.stats-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0.5rem;
}
.stats-list span:last-child {
  font-weight: 600;
  color: var(--color-text-header);
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .page-container {
        padding: 0 1rem;
    }
    .main-header {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
    .main-footer {
        flex-direction: column;
        gap: 1rem;
    }
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
    }
}

/* --- Page Catégories (Liste complète) --- */

.category-list-full {
    list-style: none;
    padding: 0;
    margin: 0;
}
.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--color-accent);
}
.category-list-full .category-item:last-child {
    border-bottom: none;
}
.category-info h3 {
    font-size: 1.5rem;
    margin: 0 0 0.25rem 0;
}
.category-info p {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.9rem;
}
.category-stats {
    font-family: var(--font-header);
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: var(--color-text);
    white-space: nowrap;
    margin-left: 2rem;
}

/* --- Page Catégorie (Liste des sujets) --- */
.main-layout-category {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}
.sidebar-text {
    color: var(--color-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.new-thread-button {
    display: block;
    text-align: center;
    width: 100%;
}
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    font-family: var(--font-header);
    letter-spacing: 1px;
}
.page-link {
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    padding: 8px 14px;
}
.page-link.active, .page-link:hover {
    background-color: var(--color-accent);
    color: var(--color-bg);
}

/* --- Pages de Formulaires --- */
.form-container {
    max-width: 600px;
    margin: 2rem auto;
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-family: var(--font-header);
    letter-spacing: 1px;
    font-size: 0.9rem;
}
.form-input {
    width: 100%;
    padding: 12px;
    background-color: var(--color-bg);
    border: 1px solid var(--color-accent);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 1rem;
}
.form-input:focus {
    outline: 2px solid var(--color-accent);
}
.form-button {
    width: 100%;
    padding-top: 12px;
    padding-bottom: 12px;
    font-family: var(--font-header);
    letter-spacing: 2px;
}

/* --- Page de Thread --- */
.thread-header {
    text-align: center;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-accent);
}
.thread-header h1 {
    font-size: 2.5rem;
}
.thread-header p {
    color: var(--color-muted);
    font-size: 0.9rem;
}
.thread-header p a:hover {
    text-decoration: underline;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.post-item {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dotted #333;
}
.post-list .post-item:first-child {
    border-top: none;
    padding-top: 0;
}
.post-author {
    text-align: center;
}
.avatar {
    width: 80px;
    height: 80px;
    border: 1px solid var(--color-accent);
    margin-bottom: 0.75rem;
}
.author-name {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1.1rem;
    display: block;
}
.post-content {
    border-left: 1px solid var(--color-accent);
    padding-left: 1.5rem;
}
.post-body a {
    color: var(--color-accent-text);
    font-weight: 600;
}
.post-body a:hover {
    text-decoration: underline;
}

/* --- Page de Profil --- */
.profile-banner {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}
.profile-avatar {
    width: 120px;
    height: 120px;
    border: 2px solid var(--color-accent);
}
.profile-info h1 {
    font-size: 2.5rem;
    margin: 0;
}
.profile-info p {
    color: var(--color-muted);
    font-size: 1.1rem;
    margin: 0;
}

.post-content a {
  color: var(--color-accent-text);
  text-decoration: none;
  border-bottom: 1px dotted var(--color-accent);
  padding-bottom: 2px;
  transition: border-bottom 0.2s ease-in-out;
}

.post-content a:hover {
  border-bottom: 1px solid var(--color-accent);
}

/* .forum-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 3fr) minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.5fr);
    gap: 16px;
    align-items: center;
    padding: 16px;
}

.forum-item:first-of-type {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}
.forum-item:last-of-type {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    margin-bottom: 0;
}
.forum-item:only-of-type {
    border-radius: 8px;
} */

.forum-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: block;
}

/* .forum-subject {
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    line-height: 1.4;
}
.forum-subject:hover {
    text-decoration: underline;
}

.forum-author,
.forum-messages,
.forum-last-message {
    font-size: 0.9rem;
}

.forum-author a {
    font-weight: 600;
    text-decoration: none;
}
.forum-author a:hover {
    text-decoration: underline;
}

.forum-messages {
    text-align: center;
}

.forum-last-message {
    text-align: right;
    white-space: nowrap;
} */

/* --- Balisage généré par Forum.php : .forum-section > a > h2.forum-header + .forum-item --- */
/* Chaque catégorie est un module encadré ; chaque fil : avatar, sujet, auteur, messages, date. */
.forum-section {
    background-color: var(--color-surface);
    border: 1px solid var(--color-accent);
    padding: 0 1.5rem 0.5rem;
}
.forum-section > a {
    display: block;
}
.forum-section > a > .forum-header {
    margin: 0;
    padding: 1.25rem 0 1rem;
    border-bottom: 1px solid var(--color-accent);
    text-align: center;
    font-size: 1.3rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.forum-section > a:hover > .forum-header {
    color: var(--color-accent-text);
}
.forum-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) minmax(0, 150px) 105px minmax(0, 250px);
    column-gap: 1.25rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px dotted rgba(var(--color-accent-rgb), 0.4);
}
.forum-item:last-child {
    border-bottom: none;
}
.forum-item .forum-avatar {
    width: 48px;
    height: 48px;
    border-radius: 0;
    border: 1px solid var(--color-accent);
    object-fit: cover;
}
.forum-subject {
    min-width: 0;
    color: var(--color-text-header);
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.forum-subject:hover {
    color: var(--color-accent-text);
}
.forum-author {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
}
.forum-author a {
    color: var(--color-accent-text);
    font-family: var(--font-header);
    font-weight: 700;
    letter-spacing: 1px;
}
.forum-author a:hover {
    color: var(--color-text-header);
}
.forum-messages {
    font-family: var(--font-header);
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-align: center;
    white-space: nowrap;
    color: var(--color-text);
}
.forum-last-message {
    font-size: 0.85rem;
    text-align: right;
    color: var(--color-text);
}

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

/* Page catégorie : le module porte déjà le titre, pas de second cadre */
.category-list-full .forum-section {
    background: none;
    border: none;
    padding: 0;
}
.category-list-full .forum-section > a {
    display: none;
}
.pagination .current-page {
    border: 1px solid var(--color-accent);
    background-color: var(--color-accent);
    color: var(--color-bg);
    padding: 8px 14px;
}

.breadcrumb-separator {
    margin: 0 0.5em;
}

.logo,
.module-header h1,
.thread-header h1,
.author-name {
    overflow-wrap: anywhere;
}

/* Contenu des messages : textes longs, images et vidéos intégrées */
.post-item {
    grid-template-columns: 150px minmax(0, 1fr);
    border-top-color: rgba(var(--color-accent-rgb), 0.4);
}
.post-author,
.post-content {
    min-width: 0;
}
.post-date {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.post-body {
    overflow-wrap: anywhere;
}
.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;
}

/* Page profil : derniers sujets et réponses (format_thread_preview / format_comment_preview) */
.profile-avatar {
    flex-shrink: 0;
    object-fit: cover;
}
.profile-info {
    min-width: 0;
}
.profile-info h1 {
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.section-title {
    margin: 0 0 0.25rem;
}
.thread-list + .section-title {
    margin-top: 1.5rem;
}
.thread-list > div {
    padding: 0.85rem 0;
    border-bottom: 1px dotted rgba(var(--color-accent-rgb), 0.4);
    overflow-wrap: anywhere;
}
.thread-list > div:last-child {
    border-bottom: none;
}
.comment-thread-title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.45;
}
.comment-thread-title a {
    color: var(--color-text-header);
    font-weight: 600;
}
.comment-thread-title a:hover {
    color: var(--color-accent-text);
}
.comment-date {
    font-size: 0.85rem;
}
.comment-thread-title + .comment-date {
    margin-top: 0.25rem;
}
.comment-date + .comment-thread-title {
    margin-top: 0.15rem;
}
.comment {
    margin-top: 0.5rem;
    white-space: pre-line;
}
.comment img,
.comment video,
.comment iframe {
    max-width: 100%;
}
.comment img,
.comment video {
    height: auto;
}
.comment iframe {
    height: auto;
    aspect-ratio: 16 / 9;
}
.comment pre {
    white-space: pre-wrap;
}

/* --- Mobile --- */
@media (max-width: 1100px) {
    .forum-item {
        grid-template-columns: 48px minmax(0, 1fr) auto;
        column-gap: 1rem;
        row-gap: 0.25rem;
    }
    .forum-item .forum-avatar {
        grid-column: 1;
        grid-row: 1 / span 3;
        align-self: start;
    }
    .forum-subject {
        grid-column: 2 / -1;
        grid-row: 1;
    }
    .forum-author {
        grid-column: 2;
        grid-row: 2;
    }
    .forum-messages {
        grid-column: 3;
        grid-row: 2;
        text-align: right;
    }
    .forum-last-message {
        grid-column: 2 / -1;
        grid-row: 3;
        text-align: left;
    }
}

@media (max-width: 900px) {
    .main-header {
        padding: 1.5rem 0;
    }
    .footer-brand {
        white-space: normal;
        text-align: center;
        overflow-wrap: anywhere;
    }
    .footer-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem 1.5rem;
    }
    .hero-banner {
        padding: 3.5rem 2rem;
    }
    .hero-content h1 {
        font-size: 2.6rem;
    }
    .thread-header h1 {
        font-size: 2rem;
        line-height: 1.35;
    }
    .post-item {
        grid-template-columns: 120px minmax(0, 1fr);
    }
    .main-layout-category {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 600px) {
    .main-header {
        gap: 1rem;
        padding: 1.25rem 0;
    }
    .logo {
        font-size: 1.4rem;
        letter-spacing: 2px;
        line-height: 1.3;
    }
    .main-nav {
        gap: 0.75rem 1.25rem;
        font-size: 0.85rem;
    }
    .main-nav .button {
        padding: 8px 14px;
    }
    .breadcrumb {
        padding: 1rem 0;
    }
    .hero-banner {
        padding: 2.5rem 1.25rem;
        margin-bottom: 2rem;
    }
    .hero-content h1 {
        font-size: 1.9rem;
        letter-spacing: 1px;
        line-height: 1.25;
    }
    .hero-content p {
        font-size: 0.95rem;
    }
    .main-layout {
        gap: 1.5rem;
    }
    .forum-section {
        padding: 0 1rem 0.25rem;
    }
    .forum-section > a > .forum-header {
        font-size: 1.15rem;
        padding: 1rem 0 0.75rem;
    }
    .forum-item {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        column-gap: 0.75rem;
        padding: 0.85rem 0;
    }
    .forum-item .forum-avatar {
        width: 40px;
        height: 40px;
    }
    .module {
        padding: 1rem;
    }
    .module-header h1 {
        font-size: 1.6rem;
        margin: 0.25rem 0;
    }
    .thread-header {
        padding: 0.5rem 0 1rem;
    }
    .thread-header h1 {
        font-size: 1.5rem;
        line-height: 1.3;
        letter-spacing: 1px;
        margin: 0.25rem 0 0.75rem;
    }
    .post-list {
        gap: 1.5rem;
    }
    .post-item {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.75rem;
    }
    .post-author {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        text-align: left;
    }
    .post-author .avatar {
        width: 48px;
        height: 48px;
        margin-bottom: 0;
        display: block;
    }
    .post-content {
        border-left: none;
        padding-left: 0;
    }
    .profile-banner {
        gap: 1rem;
    }
    .profile-avatar {
        width: 80px;
        height: 80px;
    }
    .profile-info h1 {
        font-size: 1.6rem;
        letter-spacing: 1px;
    }
    .profile-info p {
        font-size: 0.95rem;
    }
    .main-footer {
        padding: 1.5rem 0;
        margin-top: 2rem;
    }
}
