@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&family=Anton&display=swap");

:root {
  --font-heading: "Anton", sans-serif;
  --font-body: "Roboto Mono", monospace;

  --color-bg: #0a0a0a;
  --color-surface: #141414;
  --color-text: #cccccc;
  --color-text-heading: #ffffff;
  --color-accent: #ff1818;
  --color-accent-dark: #b31010;
  --color-border: #2e2e2e;
  --color-text-muted: #808080;
  --color-text-darker: #595959;
  --color-glitch-r: rgba(255, 24, 24, 0.75);
  --color-glitch-g: rgba(204, 204, 204, 0.75);
  --color-glitch-b: rgba(24, 255, 24, 0.75);
  /* Encre lisible sur l'accent (boutons pleins, liens des messages) et accent employé comme texte */
  --color-on-accent: #0a0a0a;
  --color-accent-text: #ff1818;

  --sidebar-width: 280px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  margin: 0;
  font-size: 16px;
}
.layout-wrapper {
  display: flex;
}
a {
  color: var(--color-text);
  text-decoration: none;
  transition: all 0.2s ease-in-out;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  color: var(--color-text-heading);
  margin: 0 0 1rem 0;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* --- Colonne Latérale (Sidebar) --- */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background-color: var(--color-surface);
  border-right: 2px solid var(--color-border);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}
.sidebar-top .logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-text-heading);
  letter-spacing: 1px;
  margin-bottom: 3rem;
}
.sidebar-top .logo span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.logo:hover {
  color: var(--color-accent-text);
}
.logo-image {
  height: 35px;
  width: auto;
  max-width: 120px;
  flex-shrink: 0;
  object-fit: contain;
}
.main-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 1rem;
}
.nav-link:hover,
.nav-link.active {
  color: var(--color-accent-text);
  padding-left: 10px;
}
.user-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Contenu Principal --- */
.content-area {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  padding: 1.5rem 3rem 3rem;
  min-height: 100vh;
}

/* --- Boutons --- */
.button {
  font-family: var(--font-body);
  font-weight: 700;
  padding: 10px 16px;
  border: 2px solid var(--color-accent);
  cursor: pointer;
  background: transparent;
  color: var(--color-accent-text);
  text-align: center;
}
.button-primary {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}
.button:hover {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  transform: translate(-2px, -2px);
  box-shadow: 2px 2px 0 0 var(--color-accent-dark);
}
.button-primary:hover {
  background-color: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
}

/* --- Fil d'Ariane --- */
.breadcrumb {
  padding-bottom: 1.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.breadcrumb a {
  color: var(--color-accent-text);
}
.breadcrumb span {
  color: var(--color-text-heading);
}
.breadcrumb .separator {
  margin: 0 0.5rem;
}

/* --- Listes & Cartes --- */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.5rem;
}
.list-header h1,
.list-header h2 {
  font-size: 1.8rem;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.list-header span {
  color: var(--color-accent-text);
  font-weight: 700;
}
.card {
  background-color: var(--color-surface);
  border: 2px solid var(--color-border);
  padding: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s;
}
.card:hover {
  border-color: var(--color-accent);
}
.card-content {
  flex-grow: 1;
}
.card-content h3 {
  font-size: 1.4rem;
  margin: 0 0 0.25rem 0;
}
.card-content h3 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 4px;
}
.card-content p {
  margin: 0;
  font-size: 0.9rem;
  max-width: 80ch;
}
.card-stats {
  text-align: center;
  color: var(--color-text);
  flex-shrink: 0;
  padding-left: 1.5rem;
  border-left: 2px solid var(--color-border);
  margin-left: 1.5rem;
}
.card-stats span {
  display: block;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--color-text-heading);
}
.card-stats p {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- Pagination --- */
.pagination {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.page-link,
.page-ellipsis,
.pagination .current-page {
  border: 2px solid var(--color-border);
  padding: 5px 12px;
  font-weight: 700;
}
.pagination .current-page {
  border-color: var(--color-accent);
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}
.page-link:hover,
.page-link.active {
  border-color: var(--color-accent);
  color: var(--color-accent-text);
}

/* --- Page de Sujet (Thread) --- */
.thread-card {
  gap: 1rem;
}
.thread-avatar {
  height: 40px;
  width: 40px;
  border: 2px solid var(--color-border);
}
.user-link {
  color: var(--color-accent-text);
  font-weight: 700;
}
.user-link:hover {
  text-decoration: underline;
}
.post {
  display: flex;
  gap: 1.5rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.post-author {
  flex-shrink: 0;
  width: 170px;
  min-width: 0;
  text-align: center;
  overflow-wrap: anywhere;
}
/* Pseudo un peu réduit pour tenir sur une ligne dans la colonne (une vingtaine de caractères) */
.post-author .user-link {
  display: block;
  font-size: 0.85rem;
}
.author-avatar {
  width: 80px;
  height: 80px;
  margin-bottom: 0.5rem;
  border: 2px solid var(--color-accent);
}
.author-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.post-body {
  flex-grow: 1;
  min-width: 0;
}
.post-meta {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}
/* .comment : texte des derniers messages de la page profil */
.post-content,
.comment {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.post-content p {
  margin-bottom: 1rem;
}
.post-content pre,
.comment pre {
  white-space: pre-wrap;
}
.post-content img,
.post-content video,
.post-content iframe,
.comment img,
.comment video,
.comment iframe {
  max-width: 100%;
}
.post-content img,
.post-content video,
.comment img,
.comment video {
  height: auto;
}
.post-content iframe,
.comment iframe {
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
}
/* <br> ajoutés autour des vidéos en plus des retours à la ligne conservés */
.post-content br:has(+ iframe),
.post-content iframe + br,
.comment br:has(+ iframe),
.comment iframe + br {
  display: none;
}
.post-content a,
.comment a {
  color: var(--color-on-accent);
  background-color: var(--color-accent);
  padding: 2px 5px;
  font-weight: 700;
}
.post-content a:hover,
.comment a:hover {
  background-color: var(--color-text-heading);
  color: var(--color-bg);
}

/* --- Formulaires --- */
.form-container {
  max-width: 600px;
  margin: 2rem auto;
  background-color: var(--color-surface);
  border: 2px solid var(--color-border);
  padding: 2.5rem;
}
.form-title {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 2rem;
}
.form-group {
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 700;
}
.form-input {
  width: 100%;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 2px solid var(--color-border);
  background-color: var(--color-bg);
  color: var(--color-text);
}
.form-input:focus {
  outline: none;
  border-color: var(--color-accent);
}
.form-button {
  width: 100%;
  margin-top: 1rem;
  padding: 12px;
}
.form-switch-link {
  text-align: center;
  margin-top: 1.5rem;
}
.form-switch-link a {
  color: var(--color-accent-text);
  font-weight: 700;
}

/* --- Page de Profil --- */
.profile-card {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  padding: 2rem;
}
.profile-avatar {
  width: 120px;
  height: 120px;
  border: 4px solid var(--color-accent);
  flex-shrink: 0;
}
.profile-info {
  min-width: 0;
}
.profile-info h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  overflow-wrap: anywhere;
}
.profile-info p {
  margin: 0.5rem 0;
  font-size: 1.1rem;
}
.activity-header {
  margin-top: 3rem;
}
/* Derniers messages et sujets créés (balisage généré par Forum.php) : une carte par élément */
.activity-list > div {
  background-color: var(--color-surface);
  border: 2px solid var(--color-border);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s;
}
.activity-list > div:hover {
  border-color: var(--color-accent);
}
.comment-thread-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  overflow-wrap: anywhere;
}
.comment-thread-title a {
  color: var(--color-text-heading);
}
.comment-thread-title a:hover {
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 4px;
}
.comment-date {
  font-size: 0.8rem;
  color: var(--color-text);
}
.comment-date::before {
  content: "// ";
  color: var(--color-accent-text);
  font-weight: 700;
}
.comment-thread-title + .comment-date {
  margin-top: 0.25rem;
}
.comment-date + .comment-thread-title {
  margin-top: 0.25rem;
}
.comment {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
}

/* --- Footer --- */
.main-footer {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  background-color: var(--color-surface);
  border-top: 2px solid var(--color-border);
  padding: 2rem 3rem;
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-column .logo {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}
.footer-column p {
  font-size: 0.9rem;
  margin: 0;
  color: var(--color-text-muted);
}
.footer-column h4 {
  color: var(--color-accent-text);
  font-size: 1rem;
  margin-bottom: 1rem;
}
.footer-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-column ul li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.footer-column ul a:hover {
  color: var(--color-accent-text);
  padding-left: 10px;
}
.footer-socials a {
  margin-right: 1rem;
  font-weight: 700;
}
.footer-socials a:hover {
  color: var(--color-accent-text);
}
.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* --- Hero Banner & Effets --- */
.hero-banner {
  position: relative;
  border: 2px solid var(--color-border);
  min-height: 250px;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem;
  overflow: hidden;
}
.banner-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0.3;
  filter: grayscale(1) contrast(1.5);
}
.banner-content {
  position: relative;
  z-index: 2;
}
.banner-content h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  margin: 0;
  line-height: 1;
  overflow-wrap: anywhere;
  color: var(--color-accent-text);
}
.banner-content p {
  font-size: 1.1rem;
  margin: 0.5rem 0 0 0;
  color: var(--color-text-heading);
}
.glitch {
  position: relative;
  text-shadow: 0.05em 0 0 var(--color-glitch-r),
    -0.025em -0.05em 0 var(--color-glitch-g),
    0.025em 0.05em 0 var(--color-glitch-b);
}


/* .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 ===--- */
/* Fils de l'accueil et des pages catégorie, en cartes comme le reste du modèle : avatar, sujet,
   auteur, nombre de messages, date (cf. docs/forums_generation.md §7). */
.forum-section:has(> a > .forum-header):not(:has(.forum-item)) {
  display: none;
}
.forum-section {
  margin-bottom: 2.5rem;
}
.forum-section > a {
  display: block;
  color: inherit;
}
.forum-section > a > .forum-header {
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 1rem 0;
  padding-left: 0.75rem;
  border-left: 6px solid var(--color-accent);
  overflow-wrap: anywhere;
}
/* Page catégorie : le titre est déjà dans .list-header */
.list-header + .thread-list > .forum-section > a > .forum-header {
  display: none;
}
.forum-section > a:hover > .forum-header {
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 4px;
}
.forum-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto auto;
  column-gap: 1rem;
  row-gap: 0.35rem;
  align-items: center;
  background-color: var(--color-surface);
  border: 2px solid var(--color-border);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s;
}
.forum-item:hover {
  border-color: var(--color-accent);
}
.forum-item .forum-avatar {
  grid-column: 1;
  grid-row: 1 / span 2;
  border-radius: 0;
  border: 2px solid var(--color-border);
  object-fit: cover;
}
.forum-subject {
  grid-column: 2 / -1;
  grid-row: 1;
  min-width: 0;
  color: var(--color-text-heading);
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.forum-subject:hover {
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 4px;
}
.forum-author {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}
.forum-author::before {
  content: "// ";
  color: var(--color-accent-text);
  font-weight: 700;
}
.forum-author a {
  color: var(--color-text);
  font-weight: 700;
}
.forum-author a:hover {
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
}
.forum-messages {
  grid-column: 3;
  grid-row: 2;
  padding: 0 0.5rem;
  border: 2px solid var(--color-border);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text);
  white-space: nowrap;
}
.forum-last-message {
  grid-column: 4;
  grid-row: 2;
  font-size: 0.8rem;
  color: var(--color-text);
  white-space: nowrap;
}

/* Largeur moyenne : la date passe sous l'auteur pour lui laisser la place */
@media (max-width: 1199px) {
  .forum-item {
    grid-template-columns: 48px minmax(0, 1fr) auto;
  }
  .forum-item .forum-avatar {
    grid-row: 1 / span 3;
  }
  .forum-last-message {
    grid-column: 2 / -1;
    grid-row: 3;
    white-space: normal;
  }
}

/* Tablette : la colonne latérale devient un bandeau en haut de page */
@media (max-width: 900px) {
  .layout-wrapper {
    flex-direction: column;
  }
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 2rem;
    padding: 1rem 1.5rem;
    border-right: 0;
    border-bottom: 2px solid var(--color-border);
    overflow: visible;
  }
  .sidebar-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 2rem;
    flex: 1 1 auto;
    min-width: 0;
  }
  .sidebar-top .logo {
    margin-bottom: 0;
    min-width: 0;
  }
  .main-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
  }
  .user-actions {
    flex-direction: row;
    gap: 0.75rem;
  }
  .content-area,
  .main-footer {
    margin-left: 0;
    width: auto;
  }
  .content-area {
    min-height: 0;
    padding: 1.5rem;
  }
  .main-footer {
    padding: 2rem 1.5rem;
  }
}

/* Mobile */
@media (max-width: 600px) {
  .sidebar {
    padding: 1rem;
  }
  .sidebar-top .logo {
    font-size: 1.25rem;
  }
  .user-actions {
    width: 100%;
  }
  .user-actions .button {
    flex: 1 1 0;
    padding: 8px 10px;
  }
  .content-area {
    padding: 1rem 1rem 2rem;
  }
  .hero-banner {
    min-height: 180px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
  }
  .banner-content p {
    font-size: 0.95rem;
  }
  .list-header h1,
  .list-header h2 {
    font-size: 1.4rem;
  }
  .forum-section > a > .forum-header {
    font-size: 1.25rem;
  }
  /* Sujet sur toute la largeur, auteur et compteur à la suite, date en dessous */
  .forum-item {
    display: block;
    position: relative;
    min-height: 66px;
    padding: 0.75rem 0.75rem 0.75rem 4rem;
  }
  .forum-item .forum-avatar {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 40px;
    height: 40px;
  }
  .forum-subject {
    display: block;
    margin-bottom: 0.35rem;
  }
  .forum-author {
    margin-right: 0.5rem;
  }
  .forum-messages {
    display: inline-block;
    margin: 0.15rem 0;
  }
  .forum-last-message {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    white-space: normal;
  }
  .post {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  /* Avatar et pseudo sur une ligne, message sur toute la largeur */
  .post-author {
    width: auto;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    column-gap: 0.75rem;
    align-items: center;
    text-align: left;
  }
  .post-author > a:first-child {
    grid-row: 1 / span 2;
  }
  .author-avatar {
    display: block;
    width: 48px;
    height: 48px;
    margin: 0;
  }
  .profile-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
  }
  .profile-avatar {
    width: 88px;
    height: 88px;
    border-width: 3px;
  }
  .profile-info h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }
  .profile-info p {
    font-size: 1rem;
  }
  .activity-header {
    margin-top: 2rem;
  }
  .activity-list > div {
    padding: 0.75rem;
  }
  .main-footer {
    padding: 1.5rem 1rem;
  }
}
