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

:root {
    --font-main: 'Inter', sans-serif;
    --color-bg: #1a237e;
    --color-surface: #283593;
    --color-text: #e8eaf6;
    --color-text-muted: #c5cae9;
    --color-border: #3949ab;
    --item-1-bg: #283593;
    --item-2-bg: #303f9f;
    --item-3-bg: #3949ab;
    --item-4-bg: #3f51b5;
    --item-5-bg: #5c6bc0;
    --slant-angle: -20deg;
}

/* --- 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 {
  text-decoration: none;
  color: var(--color-text);
  transition: color 0.2s;
}

a:hover {
  color: white;
  text-decoration: none;
}

h1, h2, h3, h4 {
  font-weight: 800;
  margin: 0;
}

p {
    margin-bottom: 1rem;
}

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

/* --- Header --- */
.main-header {
  padding: 1rem 2rem;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  z-index: 20;
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
}

.logo img {
  height: 32px;
  margin-right: 10px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.main-nav a {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.main-nav a:hover {
    color: white;
}

.button {
  background-color: white;
  color: var(--color-bg);
  padding: 8px 20px;
  border-radius: 99px;
  font-weight: 700;
  transition: transform 0.2s;
}

.button:hover {
    transform: scale(1.05);
    color: var(--color-bg); /* Force color keep */
}

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

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto 2rem auto;
}

.footer-column h4 {
  font-size: 1rem;
  text-transform: uppercase;
  color: white;
  margin-bottom: 1.5rem;
  letter-spacing: 1px;
}

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

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

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

.footer-column a:hover {
    color: white;
    text-decoration: underline;
}

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

/* --- Bannière --- */
.sub-header-banner {
  position: relative;
  padding: 4rem 2rem;
  text-align: center;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: var(--color-surface); /* Fallback */
}

.banner-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0.2;
  filter: blur(2px);
}

.sub-header-banner h1 {
  font-size: 2.5rem;
  position: relative;
  z-index: 2;
  text-shadow: 0 4px 20px rgba(0,0,0,0.8);
  max-width: 800px;
  line-height: 1.2;
}

.breadcrumb {
  font-size: 0.9rem;
  margin-top: 1rem;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-separator {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.breadcrumb a {
  color: var(--color-text-muted);
  background: rgba(0,0,0,0.3);
  padding: 4px 8px;
  border-radius: 4px;
}

.breadcrumb a:hover {
  color: white;
  background: rgba(0,0,0,0.6);
}

/* --- HOMEPAGE : Adaptation DOM "forum-section" --- */
.main-stage {
  display: flex;
  height: 80vh; /* Hauteur augmentée pour afficher les listes */
  min-height: 700px;
  overflow: hidden;
  background: #000;
}

.slanted-feed {
  display: flex;
  width: 120%; /* Largeur augmentée pour le skew */
  height: 100%;
  margin-left: -10%;
  transform: skewX(var(--slant-angle));
}

/* On cible .forum-section car c'est la classe dans ton DOM */
.forum-section {
  position: relative;
  height: 100%;
  cursor: pointer;
  overflow: hidden;
  flex-basis: 20%; /* 5 éléments = 20% par défaut */
  transition: flex-basis 0.6s cubic-bezier(0.25, 1, 0.5, 1), filter 0.4s;
  border-right: 1px solid rgba(0,0,0,0.3);
  
  /* Flex layout pour centrer le contenu interne */
  display: flex;
  flex-direction: column;
  
  /* Mapping des couleurs par index (car pas de classes item-1 etc) */
}

.forum-section:nth-child(1) { background: var(--item-1-bg); }
.forum-section:nth-child(2) { background: var(--item-2-bg); }
.forum-section:nth-child(3) { background: var(--item-3-bg); }
.forum-section:nth-child(4) { background: var(--item-4-bg); }
.forum-section:nth-child(5) { background: var(--item-5-bg); }

/* Etats interactifs gérés par le JS */
.forum-section.is-focused {
  flex-basis: 60%; /* S'agrandit */
  filter: brightness(1);
  cursor: default;
  overflow-y: auto; /* Scroll si la liste est longue */
}

.forum-section.is-dimmed {
  flex-basis: 10%; /* Rétrécit */
  filter: grayscale(80%) brightness(0.4);
}

/* Le Header de la section (le titre de catégorie) */
.forum-section > a {
    display: block;
    text-decoration: none;
    padding: 2rem;
    color: white;
    /* Contre-balancement du skew pour le texte */
    transform: skewX(calc(var(--slant-angle) * -1));
    transition: all 0.5s;
    text-align: center;
}

.forum-header {
    font-size: 2rem;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.3);
    white-space: nowrap;
    
    /* Etat par défaut (non focus) : Vertical ou centré simple */
    transform-origin: center;
    transition: transform 0.5s ease, font-size 0.5s ease;
}

/* Quand la section n'est PAS focus, on pivote le titre pour le style */
.forum-section:not(.is-focused) .forum-header {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin-top: 10vh;
}

.forum-section.is-focused .forum-header {
    writing-mode: horizontal-tb;
    transform: rotate(0deg);
    font-size: 3rem;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    display: inline-block;
}

/* --- Liste des sujets à l'intérieur du slanted feed --- */
/* Par défaut, les items sont cachés */
.forum-section .forum-item {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
    transform: skewX(calc(var(--slant-angle) * -1)) translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

/* Quand focus, on affiche les items */
.forum-section.is-focused .forum-item {
    opacity: 1;
    max-height: none; /* Laisser le contenu prendre sa place */
    pointer-events: auto;
    transform: skewX(calc(var(--slant-angle) * -1)) translateY(0);
    margin: 10px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    /* Transition étagée pour un effet sympa peut être ajoutée via JS, mais ici CSS simple */
    transition-delay: 0.2s;
}

/* Styles spécifiques des items de forum (Home & potentiellement ailleurs) */
.forum-item {
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: 15px;
    align-items: center;
    padding: 15px;
    color: white;
    text-align: left; /* Reset text align */
}

/* Sur mobile ou vue réduite, on adapte */
@media (min-width: 800px) {
    .forum-section.is-focused .forum-item {
        grid-template-columns: 50px 3fr 1fr 1fr 1.5fr; /* Avatar | Sujet | Auteur | Stats | Date */
    }
}

.forum-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
}

.forum-subject {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.forum-author, 
.forum-messages, 
.forum-last-message {
    font-size: 0.85rem;
    opacity: 0.8;
}

.forum-author a {
    color: white;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.3);
}

/* Cacher les détails secondaires sur les petits écrans si besoin, 
   mais ici on force l'affichage car la section est large */

/* --- PAGES INTERNES (Cards) --- */
.content-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  margin-bottom: 2rem;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.card-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--color-border);
  background: rgba(255,255,255,0.02);
}

.card-header h2 {
  font-size: 1.25rem;
  color: white;
}

.card-body {
  padding: 0; /* Padding géré par les enfants */
}

/* --- THREAD VIEW : Post Item --- */
.post-item {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  padding: 2rem;
  gap: 2rem;
}

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

/* Colonne Auteur */
.post-author {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-right: 1rem;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.post-author img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 3px solid var(--color-bg);
  box-shadow: 0 0 0 2px var(--color-border);
}

.post-author-name {
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.post-author-name a {
    color: var(--item-2-bg); /* Couleur d'accent pour les noms */
}

.post-author .item-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Colonne Contenu */
.post-content {
  flex-grow: 1;
  min-width: 0; /* Empêche l'overflow des flex items */
}

.post-content .item-meta {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.post-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
    font-size: 1.05rem;
}

/* Gestion des iframes (Youtube) dans les posts */
.post-content iframe {
    max-width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Mobile Thread View */
@media (max-width: 768px) {
    .post-item {
        flex-direction: column;
        padding: 1.5rem;
    }
    .post-author {
        width: 100%;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding-bottom: 1rem;
        margin-bottom: 1rem;
        text-align: left;
        align-items: center;
        gap: 1rem;
    }
    .post-author img {
        width: 60px;
        height: 60px;
        margin-bottom: 0;
    }
}

/* --- USER PROFILE Specifics --- */
.card-body.post-item {
    /* Reset pour la carte d'info profil qui utilise la classe post-item */
    border-bottom: none;
}

/* Listes dans le profil (Derniers sujets/réponses) */
.card-body > div {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.2s;
}

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

.card-body > div:hover {
    background-color: rgba(255,255,255,0.02);
}

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

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

.comment-thread-title a {
    color: white;
}

.comment-thread-title a:hover {
    color: var(--item-2-bg);
}

.comment {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-style: italic;
}

/* Scrollbar personnalisée pour Webkit */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}