/* ===== PALETTE SYNTHWAVE ===== */
:root {
  /* -- Polices -- */
  --font-body: "Lato", sans-serif;
  --font-heading: "Fira Code", monospace;

  /* -- Couleurs dynamiques -- */
  --color-background: #1D2128;
  --color-surface: rgba(38, 43, 51, 0.6);
  --color-border: rgba(236, 239, 244, 0.4);
  --color-border-soft: rgba(236, 239, 244, 0.1);
  --color-text: #ECEFF4;
  --color-text-muted: #B0B7C3;
  --color-magenta: #FFFFFF;
  --color-cyan: #88C0D0;
  --color-sidebar-link-hover-bg: rgba(136, 192, 208, 0.1);
  --color-pagination-hover-bg: #88C0D0;
  --color-footer-bg-solid: rgba(29, 33, 40, 0.8);
  --color-grid: rgba(136, 192, 208, 0.2);

  /* -- Ombres et effets (dérivés des couleurs primaires) -- */
  --color-shadow-magenta: 0 0 5px var(--color-magenta), 0 0 10px var(--color-magenta);
  --color-shadow-magenta-hover: 0 0 15px var(--color-magenta), 0 0 25px var(--color-magenta);
  --color-shadow-cyan: 0 0 5px var(--color-cyan), 0 0 10px var(--color-cyan);
}

/* ===== CONFIGURATION GLOBALE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  color: var(--color-magenta);
  text-shadow: var(--color-shadow-magenta);
}

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

a:hover {
  text-shadow: var(--color-shadow-cyan);
}

/* ===== CANVAS DE FOND ===== */
#grid-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

/* ===== STRUCTURE PRINCIPALE EN GRILLE ===== */
/* La page défile normalement ; la barre latérale reste fixe à l'écran (sticky). */
.site-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

/* ===== BARRE LATÉRALE ===== */
.sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  padding: 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  text-align: center;
  margin-bottom: 3rem;
}
.sidebar-logo {
  width: 80px;
  max-height: 100px;
  object-fit: contain;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 10px var(--color-cyan));
}
.sidebar-title {
  font-size: 1.75rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sidebar-link {
  font-size: 1.2rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-radius: 5px;
  border: 1px solid transparent;
}
.sidebar-link.active,
.sidebar-link:hover {
  background: var(--color-sidebar-link-hover-bg);
  border-color: var(--color-border);
  color: var(--color-cyan);
  text-shadow: var(--color-shadow-cyan);
}

/* ===== CONTENU PRINCIPAL ===== */
.main-content {
  min-width: 0;
  padding: 2rem;
}

.main-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
}
.breadcrumb {
  min-width: 0;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}
.breadcrumb a {
  color: var(--color-text-muted);
}
.breadcrumb a:hover {
  color: var(--color-cyan);
}
.breadcrumb-separator {
  margin: 0 0.5rem;
  color: var(--color-text-muted);
}
.breadcrumb-current {
  color: var(--color-text);
  font-weight: 700;
}
.user-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.action-link {
  font-weight: 700;
}
.action-button {
  background: var(--color-magenta);
  color: var(--color-background);
  font-family: var(--font-heading);
  padding: 0.5rem 1rem;
  border-radius: 5px;
  box-shadow: var(--color-shadow-magenta);
  border: none;
  cursor: pointer;
}
.action-button:hover {
  transform: scale(1.05);
  box-shadow: var(--color-shadow-magenta-hover);
  text-shadow: none;
}

/* ===== BANNIÈRE ===== */
.banner {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  margin-bottom: 2rem;
}
.banner-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0.2;
}
/* La bannière du moteur est un <img> sans classe : bandeau pleine largeur en tête de la carte */
.banner > img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--color-border);
}
.banner-text {
  position: relative;
  z-index: 2;
  padding: 2.5rem 3rem;
  text-align: center;
}
.banner h2 {
  font-size: 2.5rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.banner p {
  font-size: 1.1rem;
  color: var(--color-text-muted);
}

/* ===== LISTE DES FORUMS (PAGE D'ACCUEIL) ===== */
.categories-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Conteneur d'une section de forum (ex: Banque, Entreprise) */
.forum-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* En-tête de la section (Le titre cliquable) */
.forum-section > a {
    display: block;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
    text-decoration: none;
}
.forum-section > a:hover {
    background: rgba(255, 255, 255, 0.07);
}

.forum-header {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.3;
    color: var(--color-magenta);
    text-shadow: var(--color-shadow-magenta);
    overflow-wrap: anywhere;
}

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

/* Ligne d'un sujet (balisage généré par Forum.php) */
.forum-item {
    display: grid;
    /* Avatar | Sujet (large) | Auteur | Messages | Date */
    grid-template-columns: 40px minmax(0, 1fr) minmax(0, 8rem) minmax(6rem, auto) minmax(14.5rem, auto);
    gap: 0.5rem 1rem;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border-soft);
    transition: background 0.2s ease;
}
.forum-item > * {
    grid-row: 1;
    min-width: 0;
}

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

.forum-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.forum-avatar {
    grid-column: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--color-cyan);
    object-fit: cover;
}

.forum-subject {
    grid-column: 2;
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text);
    line-height: 1.3;
    overflow-wrap: anywhere;
    text-wrap: pretty;
}
.forum-subject:hover {
    color: var(--color-cyan);
    text-shadow: var(--color-shadow-cyan);
}

.forum-author {
    grid-column: 3;
    overflow-wrap: anywhere;
}
.forum-author,
.forum-author a {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}
.forum-author a:hover {
    color: var(--color-cyan);
}

.forum-messages {
    grid-column: 4;
    justify-self: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-align: center;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 10px;
}

.forum-last-message {
    grid-column: 5;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-align: right;
    white-space: nowrap;
}

/* ===== CATÉGORIES GÉNÉRIQUES ===== */
.category {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem;
}
.category h3 {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border-soft);
    padding-bottom: 0.5rem;
}

/* ===== TITRES DE PAGE ===== */
.page-title {
  font-size: 2rem;
  line-height: 1.4;
  margin-bottom: 2rem;
  overflow-wrap: anywhere;
}

/* ===== PAGE DE SUJET (THREAD) ===== */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.post {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}
.post-author {
  text-align: center;
  border-right: 1px solid var(--color-border-soft);
  padding-right: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--color-cyan);
  margin-bottom: 0.75rem;
  object-fit: cover;
}
.author-name {
  max-width: 100%;
  font-weight: 700;
  color: var(--color-text);
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
  overflow-wrap: anywhere;
}
.author-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.post-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.post-meta {
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-soft);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-family: var(--font-heading);
}
.post-content {
    font-size: 1rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
}
.post-content p {
  margin-bottom: 1rem;
}
.post-content img,
.post-content video {
    max-width: 100%;
    height: auto;
}
.post-content pre {
    white-space: pre-wrap;
}
/* Gestion des vidéos Youtube responsive */
.post-content iframe {
    display: block;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    margin: 0.5rem 0;
    border: 1px solid var(--color-border);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.reply-form {
  margin-top: 2rem;
  padding: 1.5rem;
}
.reply-form textarea {
  width: 100%;
  min-height: 150px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 1rem;
  font-family: var(--font-body);
  border-radius: 5px;
  margin: 1rem 0;
  resize: vertical;
}
.reply-form textarea:focus {
  outline: none;
  border-color: var(--color-magenta);
  box-shadow: var(--color-shadow-magenta);
}

/* ===== PAGE DE PROFIL UTILISATEUR ===== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  background: var(--color-surface);
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}
.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--color-magenta);
  object-fit: cover;
  box-shadow: var(--color-shadow-magenta);
}
.profile-info h1 {
  font-size: 2.5rem;
  margin: 0 0 0.5rem 0;
}
.profile-info p {
  color: var(--color-text-muted);
  font-family: var(--font-heading);
}

.profile-content-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
}

/* Liste des stats */
.stats-list {
  list-style: none;
  padding: 0;
}
.stats-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border-soft);
  color: var(--color-text-muted);
}
.stats-list li:last-child {
    border-bottom: none;
}
.stats-list strong {
  color: var(--color-cyan);
  font-weight: 700;
  text-shadow: var(--color-shadow-cyan);
}

/* Liste d'activité (Gestion de la structure DOM spécifique div dans ul) */
.thread-list {
    list-style: none;
    padding: 0;
}

/* Cible les DIVs directs dans la liste thread-list du profil */
.thread-list > div {
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border-soft);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.thread-list > div:last-child {
    border-bottom: none;
}

.comment-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-family: var(--font-heading);
}

.comment-thread-title {
    font-size: 1.1rem;
    margin: 0;
    font-weight: normal;
}
.comment-thread-title a {
    color: var(--color-text);
    font-weight: 700;
}
.comment-thread-title a:hover {
    color: var(--color-cyan);
}

/* ===== PAGES DE CONNEXION/INSCRIPTION ===== */
/* (Styles génériques conservés pour cohérence globale) */
.auth-container {
  max-width: 450px;
  margin: 4rem auto;
  padding: 2rem;
}
.form-group input {
  width: 100%;
  padding: 0.75rem;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 5px;
}

/* ===== FOOTER ===== */
.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-footer-bg-solid);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-left: -2rem;
  margin-right: -2rem;
  padding: 2rem 2rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-column h4 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--color-text);
  text-shadow: none;
  font-family: var(--font-heading);
}
.footer-column p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.footer-column ul {
  list-style: none;
  padding: 0;
}
.footer-column li {
  margin-bottom: 0.5rem;
}
.footer-column a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.footer-column a:hover {
  color: var(--color-cyan);
  text-shadow: var(--color-shadow-cyan);
}
.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--color-border-soft);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  padding-bottom: 30px;
}

/* ===== PAGINATION (pages de catégorie) ===== */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  font-family: var(--font-heading);
}
.pagination a,
.pagination span {
  min-width: 2.5rem;
  padding: 0.4rem 0.8rem;
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: var(--color-surface);
}
.pagination .current-page {
  background: var(--color-magenta);
  border-color: var(--color-magenta);
  color: var(--color-background);
  font-weight: 700;
  box-shadow: var(--color-shadow-magenta);
}
.pagination a:hover {
  border-color: var(--color-cyan);
  box-shadow: var(--color-shadow-cyan);
}

/* ===== RESPONSIVE ===== */
/* Liste des fils sur deux lignes : sujet, puis auteur / messages, puis date */
@media (max-width: 1200px) {
  .forum-item {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    row-gap: 0.35rem;
  }
  .forum-avatar {
    grid-row: 1 / span 3;
  }
  .forum-subject {
    grid-column: 2 / -1;
  }
  .forum-author {
    grid-column: 2;
    grid-row: 2;
  }
  .forum-messages {
    grid-column: 3;
    grid-row: 2;
  }
  .forum-last-message {
    grid-column: 2 / -1;
    grid-row: 3;
    text-align: left;
    white-space: normal;
  }
}

/* Tablette et mobile : la barre latérale devient un en-tête horizontal */
@media (max-width: 900px) {
  .site-grid {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding: 1rem 1.5rem;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    margin-bottom: 0;
    text-align: left;
  }
  .sidebar-header > a {
    min-width: 0;
  }
  .sidebar-header > a:first-child {
    flex-shrink: 0;
  }
  .sidebar-logo {
    display: block;
    width: 52px;
    max-height: 64px;
    margin-bottom: 0;
  }
  .sidebar-title {
    font-size: 1.3rem;
    line-height: 1.3;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .sidebar-link {
    font-size: 1rem;
    padding: 0.4rem 0.75rem;
  }
  .main-content {
    padding: 1.5rem;
  }
  .site-footer {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding: 2rem 1.5rem 0 1.5rem;
  }
  .profile-content-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Mobile */
@media (max-width: 600px) {
  .sidebar {
    padding: 0.75rem 1rem;
  }
  .sidebar-logo {
    width: 44px;
    max-height: 56px;
  }
  .sidebar-title {
    font-size: 1.1rem;
  }
  .sidebar-link {
    padding: 0.3rem 0.6rem;
  }
  .main-content {
    padding: 1rem;
  }
  .main-header {
    margin-bottom: 1.25rem;
  }
  .site-footer {
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 1.5rem 1rem 0 1rem;
  }
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }
  .banner {
    margin-bottom: 1.5rem;
  }
  .banner-text {
    padding: 1.5rem 1rem;
  }
  .banner h2 {
    font-size: 1.5rem;
  }
  .banner p {
    font-size: 1rem;
  }
  .categories-container {
    gap: 1.25rem;
  }
  .page-title {
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
  }
  .forum-section > a {
    padding: 0.85rem 1rem;
  }
  .forum-header {
    font-size: 1.25rem;
  }
  .forum-item {
    column-gap: 0.75rem;
    padding: 0.85rem 1rem;
  }
  .post {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem;
  }
  .post-author {
    flex-direction: row;
    gap: 0.75rem;
    text-align: left;
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--color-border-soft);
    padding-bottom: 0.75rem;
  }
  .author-avatar {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
  }
  .author-name {
    margin-bottom: 0;
  }
  .reply-form {
    padding: 1rem;
  }
  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
    padding: 1.5rem 1rem;
  }
  .profile-info h1 {
    font-size: 1.75rem;
    overflow-wrap: anywhere;
  }
}