/* --- Polices & Variables --- */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap");

:root {
  --font-main: "Inter", sans-serif;
  --color-bg: #f4e9d8;
  --color-surface: #fffbf2;
  --color-text: #001f3f;
  --color-text-muted: #7d6e5f;
  --color-accent: #3498db;
  --color-border: #e9dcc8;
}

/* --- Styles Généraux --- */
body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--color-accent); /* Utilisation de la variable accent par défaut */
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 700;
}

a:hover {
  opacity: 0.8;
}

h1, h2, h3, h4 {
  font-weight: 900;
  margin: 0;
  color: var(--color-text);
}

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

/* --- Header & Footer --- */
.main-header {
  background-color: var(--color-surface);
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--color-border);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-weight: 900;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
}

.logo img {
  height: 32px; /* Ajusté pour mieux correspondre */
  width: auto;
}

.main-nav {
  display: flex;
  gap: 2rem;
  font-weight: 700;
}

.main-nav a {
  color: var(--color-text);
}

.main-nav a:hover {
  color: var(--color-accent);
}

/* Footer */
.main-footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: 3rem;
  padding: 3rem 2rem 1rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.main-footer > div:not(.footer-bottom) {
    /* Container pour les colonnes du footer s'il n'y a pas de wrapper direct dans le DOM */
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-column {
    min-width: 200px;
}

.footer-column h4 {
  font-size: 1rem;
  text-transform: uppercase;
  margin-bottom: 1rem;
  color: var(--color-text);
}

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

.footer-column li {
  margin-bottom: 0.5rem;
}

.footer-column a {
  font-weight: 400;
  color: var(--color-text-muted);
}

.footer-column a:hover {
  color: var(--color-accent);
}

.footer-bottom {
  text-align: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

/* --- Bannière & Breadcrumb --- */
.hero-type {
  position: relative;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 250px;
  overflow: hidden;
  background-color: var(--color-surface);
}

.hero-content {
  position: relative;
  z-index: 3;
  padding: 2rem;
  max-width: 800px;
}

.hero-content h1 {
  font-size: 2.5rem; /* Ajusté pour éviter les débordements sur les longs titres */
  line-height: 1.2;
}

.hero-type.with-banner {
  color: white;
}

.hero-type.with-banner .hero-content h1 {
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hero-banner-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

/* Overlay sombre pour la lisibilité */
.hero-type.with-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.breadcrumb {
  padding: 1rem 2rem;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

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

/* --- Layout Principal --- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr; /* Mobile first */
  gap: 2rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .main-grid {
    grid-template-columns: 3fr 1fr; /* Colonne principale + Sidebar */
  }
}

/* Correction pour les pages thread/user qui ont <main style="padding: 2rem"> sans .main-grid */
main:not(.main-grid) {
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* --- Blocs de contenu Génériques --- */
.content-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px; /* Léger arrondi pour moderniser */
  margin-bottom: 2rem;
  overflow: hidden;
}

.block-header {
  padding: 1rem;
  background-color: rgba(0,0,0,0.02);
  border-bottom: 1px solid var(--color-border);
  text-transform: uppercase;
  font-weight: 900;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

.block-content {
  padding: 1.5rem;
}

/* --- PAGE D'ACCUEIL : Liste des Forums --- */

.forum-section {
    margin-bottom: 2rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: 8px;
    overflow: hidden;
}

/* Le titre de la section est dans un lien <a><h2>...</h2></a> */
.forum-section > a {
    display: block;
    text-decoration: none;
}

.forum-header {
    padding: 1rem 1.5rem;
    background-color: rgba(0,0,0,0.03);
    border-bottom: 1px solid var(--color-border);
    font-size: 1.2rem;
    color: var(--color-text);
    transition: background-color 0.2s;
}

.forum-section > a:hover .forum-header {
    background-color: rgba(0,0,0,0.05);
}

.forum-item {
    display: grid;
    /* Avatar | Sujet | Auteur | Messages | Dernier msg */
    grid-template-columns: 60px 1fr 140px 100px 180px; 
    gap: 1rem;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.1s;
}

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

.forum-item:hover {
    background-color: rgba(0,0,0,0.01);
}

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

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

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

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

.forum-author a {
    color: var(--color-text);
    font-weight: 600;
}

.forum-messages {
    text-align: center;
    font-weight: 600;
}

.forum-last-message {
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive pour la liste des forums */
@media (max-width: 900px) {
    .forum-item {
        grid-template-columns: 48px 1fr;
        grid-template-rows: auto auto;
        gap: 0.5rem 1rem;
    }
    
    .forum-avatar {
        grid-row: 1 / 3;
    }
    
    .forum-subject {
        grid-column: 2;
    }
    
    .forum-author, 
    .forum-messages, 
    .forum-last-message {
        display: inline-block;
        margin-right: 1rem;
        grid-column: 2;
        font-size: 0.8rem;
    }
}

/* --- PAGE SUJET (Threads) --- */

.post {
  display: grid;
  grid-template-columns: 180px 1fr; /* Colonne auteur plus large */
  gap: 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-border);
}

.post:last-child {
    border-bottom: none;
}

.post-author {
  text-align: center;
  padding-right: 1rem;
}

.post-author img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 1rem auto;
  border: 3px solid var(--color-border);
}

.post-author .author-name {
  display: block;
  font-weight: 900;
  color: var(--color-text);
  font-size: 1.1rem;
}

.post-content {
    line-height: 1.6;
}

.post-meta {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border); /* Petit séparateur visuel */
  display: inline-block;
}

/* Vidéos et images dans les posts */
.post-content iframe,
.post-content img {
    max-width: 100%;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Responsive posts */
@media (max-width: 768px) {
    .post {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .post-author {
        display: flex;
        align-items: center;
        gap: 1rem;
        text-align: left;
        padding-right: 0;
        background: rgba(0,0,0,0.02);
        padding: 1rem;
        border-radius: 8px;
    }
    .post-author img {
        margin: 0;
        width: 48px;
        height: 48px;
    }
}

/* Formulaire de réponse */
.reply-form textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 150px;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-main);
  resize: vertical;
}

.button {
  display: inline-block;
  padding: 12px 24px;
  background: var(--color-text); /* Noir par défaut ou couleur texte */
  color: var(--color-bg);
  border: none;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  transition: opacity 0.2s;
}

.button:hover {
  opacity: 0.9;
}

/* --- PAGE PROFIL (User) --- */

.profile-header {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--color-border);
}

.profile-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.profile-header p {
    margin: 0.25rem 0;
    color: var(--color-text-muted);
}

/* Styles pour les listes d'activités (Sujets créés / Réponses) */
/* Le DOM met des divs simples les uns après les autres */

.block-content > div {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.block-content > div:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.comment-date {
    font-size: 0.8rem;
    color: var(--color-accent);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

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

.comment-thread-title a {
    color: var(--color-text);
}

.comment-thread-title a:hover {
    color: var(--color-accent);
}

.comment {
    background-color: rgba(0,0,0,0.03);
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    position: relative;
    border-left: 3px solid var(--color-accent); /* Touche visuelle */
}

/* --- Liens animés dans le corps des messages (Style spécifique demandé conservé) --- */
.post-content a,
.comment a {
    color: var(--color-text); 
    text-decoration: none; 
    font-weight: 700;
    
    background-image: linear-gradient(var(--color-accent), var(--color-accent));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 100% 2px; /* Soulignement complet par défaut pour la visibilité */
    transition: background-size 0.3s ease, color 0.3s ease;
}

.post-content a:hover,
.comment a:hover {
    color: var(--color-accent);
    background-size: 100% 100%; /* Effet de surlignage au survol */
    color: white; /* Texte blanc sur fond accent */
}