/* --- Variables de Thème Neumorphique --- */
:root {
    /* Couleurs de base */
    --bg-color: #effaf6;
    --primary-color: #007966;
    --text-color: #004d40;
    --text-color-light: #3d958d;
    --shadow-light: #ffffff;
    --shadow-dark: #d1e0d9;

    /* Couleurs des éléments Neumorphiques */
    --neumorphic-bg: rgba(239, 250, 246, 0.7);

    /* Couleurs de la bannière */
    --banner-text-color: #ffffff;
    --banner-text-shadow: rgba(0, 0, 0, 0.5);

    /* Couleurs des bordures et séparateurs */
    --border-color: rgba(209, 224, 217, 0.5);

    /* Couleurs pour l'animation JS */
    --blob-color-1: #ade8f4;
    --blob-color-2: #90e0ef;
    --blob-color-3: #80ed99;
    --blob-color-4: #c7f9cc;

    /* Polices (statique) */
    --font-family: "Poppins", "Segoe UI", "Helvetica Neue", sans-serif;
}

/* --- Base et Réinitialisation --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* --- Fond Animé --- */
#blob-canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

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

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

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

/* --- Style Neumorphique de base --- */
.neumorphic {
  background: var(--neumorphic-bg);
  backdrop-filter: blur(5px);
  border-radius: 20px;
  box-shadow: -8px -8px 15px var(--shadow-light),
    8px 8px 15px var(--shadow-dark);
  transition: box-shadow 0.3s ease;
}

.neumorphic-inset {
  box-shadow: inset -8px -8px 15px var(--shadow-light),
    inset 8px 8px 15px var(--shadow-dark);
}

.neumorphic-button {
  padding: 10px 20px;
  border-radius: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  display: inline-block;
  text-align: center;
}

.neumorphic-button:hover,
.neumorphic-button:active {
  box-shadow: inset -5px -5px 10px var(--shadow-light),
    inset 5px 5px 10px var(--shadow-dark);
  color: var(--primary-color);
}

/* --- Conteneurs principaux --- */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.content-wrapper {
  margin-top: 30px;
  margin-bottom: 30px;
}

/* --- Header & Footer --- */
.main-header,
.main-footer {
  padding: 15px 30px;
}

.main-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 20px;
}

.logo {
  height: 50px;
  width: auto;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.nav-item {
  padding: 10px 20px;
  font-weight: 500;
  border-radius: 15px;
  transition: all 0.3s ease;
}

.nav-item.active,
.nav-item:hover {
  color: var(--primary-color);
  box-shadow: inset -5px -5px 10px var(--shadow-light),
    inset 5px 5px 10px var(--shadow-dark);
}

.main-footer {
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 30px;
  margin-bottom: 15px;
}

.footer-links a {
  font-weight: 500;
}

.footer-copyright {
  font-size: 0.8em;
  color: var(--text-color-light);
}

/* --- Fil d'Ariane --- */
.breadcrumb {
  padding-bottom: 20px;
  font-size: 0.9em;
  color: var(--text-color-light);
}

.breadcrumb a {
  margin-right: 5px;
}

.breadcrumb span {
  margin-right: 5px;
}

/* --- Bannière (home.html) --- */
.banner {
  padding: 10px;
  position: relative;
  margin-bottom: 40px;
}

/* L'image couvre la bannière, le texte en fixe la hauteur : un nom long ne déborde plus */
.banner-image {
  position: absolute;
  top: 10px;
  left: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  object-fit: cover;
  border-radius: 15px;
  filter: brightness(60%);
}

.banner-overlay {
  position: relative;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px 20px;
  text-align: center;
  color: var(--banner-text-color);
  text-shadow: 0 2px 10px var(--banner-text-shadow);
}

.banner-title {
  font-size: 2.5em;
  font-weight: 700;
  line-height: 1.25;
  color: var(--banner-text-color);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.banner-subtitle {
  font-size: 1.2em;
}

/* --- Sections & Titres --- */
.section-title {
  margin-bottom: 20px;
  padding-left: 10px;
  font-size: 1.8em;
}

.main-content-panel {
  padding: 30px;
}

.category-section,
.threads-section {
  margin-bottom: 40px;
}

/* --- Grille des catégories (home.html) --- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 30px;
}

.category-card {
  padding: 25px;
  text-align: center;
}

.category-card:hover {
  box-shadow: inset -8px -8px 15px var(--shadow-light),
    inset 8px 8px 15px var(--shadow-dark);
}

.category-card:hover h3 {
  color: var(--primary-color);
}

.category-card h3 {
  font-size: 1.2em;
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.category-card p {
  font-size: 0.9em;
  color: var(--text-color-light);
}

.all-categories-link {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Liste de Sujets/Catégories (home, category, categories) --- */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  color: var(--text-color);
}

.list-item:hover {
  box-shadow: -5px -5px 10px var(--shadow-light),
    5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light),
    inset 5px 5px 10px var(--shadow-dark);
}

.item-details .item-title {
  font-size: 1.1em;
  font-weight: 600;
  display: block;
  margin-bottom: 5px;
}

.item-details .item-meta,
.item-details .item-description {
  font-size: 0.8em;
  color: var(--text-color-light);
}

.item-stats {
  text-align: right;
  font-size: 0.85em;
  color: var(--text-color-light);
  flex-shrink: 0;
  margin-left: 20px;
}

.item-stats .stat-item {
  display: block;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.page-item {
  padding: 10px 15px;
  font-size: 0.9em;
}

.page-item.active {
  box-shadow: inset -5px -5px 10px var(--shadow-light),
    inset 5px 5px 10px var(--shadow-dark);
  color: var(--primary-color);
  font-weight: 700;
}

/* --- Page de Sujet (thread.html) --- */
.post-content {
  margin-top: 15px;
  line-height: 1.7;
}

.comment-content a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.comment-content a:hover {
  text-decoration: none;
}

.thread-actions {
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.comments-section {
  margin-top: 30px;
}

.comment {
  display: flex;
  gap: 20px;
  padding: 20px;
}

.comments-section > .comment + .comment {
  margin-top: 25px;
}

.comment:has(> .comment-body) > a {
  flex-shrink: 0;
}

.comment-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.comment-body {
  flex-grow: 1;
  min-width: 0;
}

.comment-meta {
  font-size: 0.9em;
  margin-bottom: 10px;
  color: var(--text-color-light);
}

.comment-author {
  font-weight: 600;
  color: var(--text-color);
  margin-right: 10px;
}

/* Les messages sont du texte brut : on garde leurs retours à la ligne */
.comment-content {
  font-size: 0.95em;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

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

.comment-content iframe,
.profile-main .comment iframe {
  display: inline-block;
  vertical-align: top;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
}

.comment-content video,
.profile-main .comment video {
  max-width: 100%;
  height: auto;
}

/* Le moteur entoure les vidéos de retours à la ligne et de <br> : une seule ligne vide de chaque côté */
.comment-content br:has(+ iframe),
.comment-content iframe + br,
.profile-main .comment br:has(+ iframe),
.profile-main .comment iframe + br {
  display: none;
}

.replies {
  margin-top: 20px;
  margin-bottom: 20px;
  padding-left: 30px;
  border-left: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Page de Profil (user.html) --- */
.profile-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 30px;
}

.profile-sidebar {
  text-align: center;
}

.profile-avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 0 auto 20px auto;
  padding: 10px;
}

.profile-username {
  font-size: 1.8em;
  margin-bottom: 20px;
}

.profile-stats {
  list-style: none;
  text-align: left;
}

.profile-stats li {
  margin-bottom: 10px;
  font-size: 0.9em;
}

.profile-main .neumorphic {
  padding: 25px;
  margin-bottom: 20px;
}

/* Activité récente (balisage de Forum.php : div > h4.comment-thread-title + .comment-date + .comment) */
.profile-main .item-list > div {
  min-width: 0;
  padding: 20px 25px;
  background: var(--neumorphic-bg);
  border-radius: 20px;
  box-shadow: -8px -8px 15px var(--shadow-light),
    8px 8px 15px var(--shadow-dark);
}

.comment-thread-title {
  font-size: 1.05em;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.profile-main .comment-date {
  font-size: 0.85em;
  color: var(--text-color-light);
}

.profile-main .comment {
  display: block;
  margin-top: 10px;
  padding: 0;
  font-size: 0.95em;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.profile-main .comment a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- Pages de Connexion / Inscription --- */
.auth-container {
  max-width: 450px;
  margin: 40px auto;
  padding: 40px;
}

.auth-title {
  text-align: center;
  font-size: 2em;
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--text-color-light);
}

.form-input {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 15px;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 1em;
}

.form-input:focus {
  outline: none;
  box-shadow: -2px -2px 5px var(--shadow-light), 2px 2px 5px var(--shadow-dark);
}

.auth-submit {
  width: 100%;
  padding: 15px;
  font-size: 1.1em;
  margin-top: 10px;
}

.auth-footer-text {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9em;
}

/* --- Sections ajoutées --- */
.comment-actions {
  margin-top: 15px;
  display: flex;
  gap: 20px;
  font-size: 0.8em;
}

.comment-actions a {
  font-weight: 600;
  color: var(--text-color-light);
}

.comment-actions a:hover {
  color: var(--primary-color);
}

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

a.comment-author:hover,
a.item-author:hover,
.item-author a:hover {
  color: var(--primary-color);
}

.main-header .logo-link {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
  gap: 12px;
  min-width: 0;
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* Au-dessus de 900 px, le header reste sur une ligne : c'est le nom du site qui passe à la ligne */
@media (min-width: 901px) {
  .main-header {
    flex-wrap: nowrap;
  }

  .main-nav,
  .nav-button {
    flex-shrink: 0;
  }
}

/* Texte posé sur le fond animé : un léger halo de la couleur du fond le garde lisible */
.breadcrumb,
.section-title,
.forum-section > a > .forum-header {
  text-shadow: 0 0 3px var(--bg-color), 0 0 10px var(--bg-color);
}

.main-content-panel h1 {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* Pagination des pages catégorie (balisage de Forum.php) */
.pagination .current-page,
.pagination .page-link {
  padding: 8px 15px;
  border-radius: 15px;
  font-size: 0.9em;
  font-weight: 500;
}

.pagination .current-page {
  color: var(--primary-color);
  font-weight: 700;
  box-shadow: inset -5px -5px 10px var(--shadow-light),
    inset 5px 5px 10px var(--shadow-dark);
}

.pagination .page-link:hover {
  box-shadow: inset -5px -5px 10px var(--shadow-light),
    inset 5px 5px 10px var(--shadow-dark);
}

/* ---=== Balisage généré par Forum.php : .forum-section > a > h2.forum-header + .forum-item ===--- */
/* Chaque fil est une carte neumorphique, comme .list-item : avatar, sujet et auteur à gauche,
   nombre de messages et date à droite (cf. docs/forums_generation.md §7). */
.forum-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 40px;
}

.forum-section:has(> a > .forum-header):not(:has(.forum-item)) {
  display: none;
}

.forum-section > a {
  display: block;
  align-self: flex-start;
  max-width: 100%;
  color: inherit;
}

.forum-section > a > .forum-header {
  padding-left: 10px;
  font-size: 1.4em;
  color: var(--text-color);
  overflow-wrap: anywhere;
  transition: color 0.3s ease;
}

.forum-section > a:hover > .forum-header {
  color: var(--primary-color);
}

.forum-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  column-gap: 20px;
  row-gap: 4px;
  align-items: center;
  padding: 18px 25px;
  background: var(--neumorphic-bg);
  border-radius: 20px;
  box-shadow: -8px -8px 15px var(--shadow-light),
    8px 8px 15px var(--shadow-dark);
  transition: box-shadow 0.3s ease;
}

.forum-item:hover {
  box-shadow: -5px -5px 10px var(--shadow-light),
    5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light),
    inset 5px 5px 10px var(--shadow-dark);
}

.forum-avatar {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.forum-subject {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  font-size: 1.05em;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.forum-author {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

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

.forum-author a:hover {
  color: var(--primary-color);
}

.forum-messages,
.forum-last-message {
  grid-column: 3;
  font-size: 0.85em;
  color: var(--text-color-light);
  text-align: right;
  white-space: nowrap;
}

.forum-messages {
  grid-row: 1;
  align-self: end;
}

.forum-last-message {
  grid-row: 2;
  align-self: start;
}

/* --- Mobile --- */
@media (max-width: 900px) {
  .main-header {
    justify-content: center;
  }

  .main-header .logo-link {
    flex: 1 1 100%;
    text-align: center;
  }

  .forum-item .forum-avatar {
    grid-row: 1 / span 3;
  }

  .forum-subject {
    grid-column: 2 / -1;
  }

  .forum-messages {
    grid-row: 2;
    align-self: center;
  }

  .forum-last-message {
    grid-column: 2 / -1;
    grid-row: 3;
  }

  .profile-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  .main-header,
  .main-footer {
    padding: 15px;
  }

  .main-header .logo-link {
    gap: 10px;
    font-size: 1.25rem;
  }

  .logo {
    height: 40px;
  }

  .main-nav {
    justify-content: center;
    gap: 5px;
  }

  .nav-item {
    padding: 8px 12px;
  }

  .nav-button {
    padding: 8px 16px;
  }

  .banner {
    margin-bottom: 30px;
  }

  .banner-overlay {
    min-height: 180px;
    padding: 20px 12px;
  }

  .banner-title {
    font-size: 1.6em;
  }

  .banner-subtitle {
    font-size: 1em;
  }

  .section-title {
    font-size: 1.45em;
    overflow-wrap: anywhere;
  }

  .main-content-panel {
    padding: 20px 15px;
  }

  .main-content-panel h1 {
    font-size: 1.45em;
  }

  .forum-section > a > .forum-header {
    font-size: 1.25em;
  }

  .forum-item {
    grid-template-columns: 40px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 2px;
    padding: 15px;
  }

  .forum-item .forum-avatar {
    grid-row: 1 / span 2;
    align-self: start;
    width: 40px;
    height: 40px;
  }

  .forum-messages,
  .forum-last-message {
    grid-column: 2;
    text-align: left;
    white-space: normal;
    align-self: start;
  }

  .forum-messages {
    grid-row: 3;
  }

  .forum-last-message {
    grid-row: 4;
  }

  /* Message : avatar et auteur sur une ligne, texte sur toute la largeur */
  .comment:has(> .comment-body) {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 10px;
    padding: 15px;
  }

  .comment-avatar {
    width: 40px;
    height: 40px;
  }

  .comment-body {
    display: contents;
  }

  .comment-meta {
    grid-column: 2;
    align-self: center;
    margin-bottom: 0;
  }

  .comment-content,
  .comment-actions {
    grid-column: 1 / -1;
  }

  .comment-actions {
    margin-top: 0;
  }

  .profile-avatar {
    width: 120px;
    height: 120px;
  }

  .profile-main .neumorphic,
  .profile-main .item-list > div {
    padding: 15px;
  }
}
