@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Inter:wght@400;500;600&display=swap");

:root {
  /* --- PALETTE DE BASE --- */
  --white: #000000;
  --black: #ffffff;
  --transparent: transparent;

  /* --- ARRIÈRE-PLANS --- */
  --bg-body: #2e2e2e;
  --bg-card: #3e3e3e;
  --bg-glass: rgba(62, 62, 62, 0.9);
  --bg-message: #4e4e4e;
  --bg-darker: #1a1a1a;
  --bg-nav-pill: rgba(250, 255, 0, 0.1);
  --bg-hover-light: rgba(250, 255, 0, 0.2);
  --bg-overlay-dark: rgba(0, 0, 0, 0.5);
  --bg-overlay-light: rgba(62, 62, 62, 0.4);

  /* --- MARQUE & ACCENTS --- */
  --brand-gradient: linear-gradient(135deg, #eab308 0%, #facc15 100%);
  --accent: #facc15;
  --accent-glow: rgba(250, 204, 21, 0.5);
  --logo-shadow: rgba(250, 204, 21, 0.3);

  /* --- TEXTE --- */
  --text-main: #ffffff;
  --text-bright: #facc15;
  --text-muted: #d4d4d4;
  --text-dim: #a3a3a3;
  --text-darker: #525252;
  --text-italic: #e5e5e5;
  --text-on-brand: #2e2e2e;
  --link-on-message: #facc15;

  /* --- BORDURES --- */
  --border-light: rgba(255, 255, 255, 0.15);
  --border-glow: rgba(250, 204, 21, 0.6);
  --border-avatar: #525252;

  /* --- OMBRES --- */
  --shadow-sm: rgba(0, 0, 0, 0.4);
  --shadow-md: rgba(0, 0, 0, 0.5);
  --shadow-lg: rgba(0, 0, 0, 0.7);
  --shadow-text: rgba(0, 0, 0, 0.8);

  /* --- DÉCORATION --- */
  --grad-orb-1: rgba(234, 179, 8, 0.15);
  --grad-orb-2: rgba(250, 204, 21, 0.1);
  --grad-auth-orb: rgba(253, 224, 71, 0.2);

  /* --- FONTS --- */
  --font-head: "Outfit", sans-serif;
  --font-body: "Inter", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-body);
  background-image: radial-gradient(
      circle at 15% 50%,
      var(--grad-orb-1),
      var(--transparent) 25%
    ),
    radial-gradient(circle at 85% 30%, var(--grad-orb-2), var(--transparent) 25%);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

ul {
  list-style: none;
}

/* --- HEADER GLASS --- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  min-height: 70px;
  display: flex;
  align-items: center;
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-area img {
  height: 40px;
  width: auto;
  filter: drop-shadow(0 0 8px var(--logo-shadow));
}

.site-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.5px;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: var(--transparent);
}

nav ul {
  display: flex;
  background: var(--bg-nav-pill);
  padding: 5px;
  border-radius: 50px;
  border: 1px solid var(--border-light);
}

nav a {
  padding: 8px 20px;
  border-radius: 30px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
}

nav a:hover {
  color: var(--text-main);
  background: var(--bg-hover-light);
}

nav a.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 2px 10px var(--shadow-sm);
  border: 1px solid var(--border-light);
}

/* --- BANNIÈRE --- */
.banner-container {
  width: 100%;
  height: 280px;
  position: relative;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, var(--black) 60%, var(--transparent) 100%);
  -webkit-mask-image: linear-gradient(to bottom, var(--black) 60%, var(--transparent) 100%);
  background: var(--bg-card);
}

.banner-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.05);
}

/* --- MAIN CONTAINER --- */
.main-container {
  width: 100%;
  max-width: 1080px;
  margin: -50px auto 40px;
  padding: 0 25px;
  position: relative;
  z-index: 10;
  flex: 1;
}

/* --- TYPOGRAPHY & BREADCRUMB --- */
h1.page-title {
  font-family: var(--font-head);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 10px;
  text-shadow: 0 10px 30px var(--shadow-text);
}

p.page-desc {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 700px;
  margin-bottom: 40px;
}

.breadcrumb {
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg-overlay-dark);
  display: inline-block;
  padding: 5px 15px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.breadcrumb-separator {
  margin: 0 8px;
  color: var(--border-light);
}

.breadcrumb-item {
  color: var(--text-muted);
}

.breadcrumb-item:hover {
  color: var(--accent);
}

/* --- CATEGORIES & LISTS --- */
.forum-section {
  margin-bottom: 40px;
}

.forum-header {
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: var(--text-main);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.forum-header::before {
  content: "";
  display: block;
  width: 4px;
  height: 24px;
  background: var(--brand-gradient);
  border-radius: 2px;
}

.forum-item {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  padding: 18px 24px;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.forum-item:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--shadow-md);
}

.forum-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin-right: 20px;
  border: 2px solid var(--border-avatar);
  object-fit: cover;
}

.forum-subject {
  flex: 1;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-main);
  padding-right: 20px;
}

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

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

.forum-messages {
  background: var(--bg-hover-light);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 20px;
  border: 1px solid var(--border-light);
}

.forum-last-message {
  width: 200px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* --- THREAD & COMMENTS --- */
.comment-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  animation: fadeIn 0.4s ease;
}

.comment-sidebar {
  width: 150px;
  flex-shrink: 0;
  text-align: center;
  background: var(--bg-card);
  padding: 20px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  height: fit-content;
}

.comment-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 10px;
  border: 3px solid var(--bg-body);
  box-shadow: 0 0 0 2px var(--accent);
}

.comment-author-name {
  display: block;
  font-weight: 700;
  font-family: var(--font-head);
  margin-bottom: 5px;
  color: var(--text-main);
}

.comment-body {
  flex: 1;
  background: var(--bg-message);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}

.comment-meta {
  background: var(--bg-overlay-light);
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.comment-content {
  padding: 25px;
  color: var(--text-bright);
  font-size: 1rem;
}

/* Style des liens dans les messages */
.comment-content a {
  color: var(--link-on-message);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.comment-content a:hover {
  color: var(--white);
}

/* --- USER PROFILE --- */
.profile-header {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 30px;
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.profile-header::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--brand-gradient);
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--bg-body);
  box-shadow: 0 0 20px var(--accent-glow);
}

.profile-info h1 {
  font-family: var(--font-head);
  font-size: 2rem;
  margin-bottom: 5px;
}

.profile-job {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 15px;
  display: block;
}

.profile-stats {
  display: flex;
  gap: 20px;
  margin-top: 15px;
}

.stat-badge {
  background: var(--bg-hover-light);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.profile-col h3 {
  font-family: var(--font-head);
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 10px;
}

.profile-col > div {
  background: var(--bg-card);
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.comment-thread-title a {
  font-weight: 600;
  color: var(--text-main);
}

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

.comment-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 5px 0;
}

.comment {
  font-size: 0.9rem;
  color: var(--text-italic);
  font-style: italic;
}

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

.page-link,
.current-page {
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.page-link {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}

.page-link:hover {
  border-color: var(--accent);
  color: var(--text-main);
}

.current-page {
  background: var(--accent);
  color: var(--bg-body);
  box-shadow: 0 4px 15px var(--accent-glow);
}

/* --- FOOTER --- */
footer {
  background: var(--bg-darker);
  border-top: 1px solid var(--border-light);
  padding: 60px 0 30px;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 25px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer-col h4 {
  font-family: var(--font-head);
  color: var(--text-main);
  margin-bottom: 20px;
}

.footer-col ul li {
  margin-bottom: 10px;
}

.footer-col a {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

.footer-bottom {
  text-align: center;
  margin-top: 60px;
  padding-top: 30px;
  border-top: 1px solid var(--border-light);
  color: var(--text-darker);
  font-size: 0.85rem;
}

/* --- LOGIN / REGISTER --- */
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 40px;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px var(--shadow-lg);
  position: relative;
  z-index: 10;
}

.auth-form {
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: radial-gradient(
    circle at 50% 50%,
    var(--grad-auth-orb),
    var(--transparent) 50%
  );
  height: 80vh;
}

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

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

.form-group input {
  width: 100%;
  padding: 12px 15px;
  background: var(--bg-darker);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--white);
  font-family: var(--font-body);
  outline: none;
  transition: 0.3s;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-full {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-family: var(--font-head);
  cursor: pointer;
  background: var(--bg-message);
  color: var(--white);
  transition: 0.3s;
}

.btn-full:hover {
  background: var(--bg-card); /* Légère variation au survol */
  transform: translateY(-2px);
}

.btn-full.btn-register {
  background: var(--brand-gradient);
}

.btn-register, .btn-submit {
  margin-left: 10px;
  background: var(--brand-gradient);
  color: var(--text-on-brand);
  font-weight: 600;
  border-radius: 26px;
  padding: 7px;
  padding-left: 15px;
  padding-right: 15px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---=== Balisage généré par Forum.php : .forum-section > a > h2.forum-header + .forum-item ===--- */
/* Catégories vides masquées sur l'accueil */
.forum-section:has(> a > .forum-header):not(:has(.forum-item)) {
  display: none;
}

.forum-section > a {
  display: block;
}

.forum-section > a > .forum-header {
  overflow-wrap: anywhere;
}

.forum-avatar {
  flex-shrink: 0;
}

.forum-subject {
  min-width: 0;
  overflow-wrap: anywhere;
}

.forum-author {
  flex-shrink: 0;
  max-width: 170px;
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.forum-messages {
  flex-shrink: 0;
  white-space: nowrap;
}

.forum-last-message {
  flex-shrink: 0;
  width: 240px; /* « Dernier message : 30 Septembre 2026 » sur une ligne */
}

/* Pagination de catégorie : rien à afficher s'il n'y a qu'une page */
.pagination:not(:has(.page-link)) {
  display: none;
}

/* head.html enveloppe footer.html dans <footer class="footer"> : le </div> de tête du footer
   referme cette enveloppe, qui reste vide dans .main-container et dessinait une bande sombre */
.main-container > .footer {
  display: none;
}

/* Boutons (lien ou <button>) */
.btn {
  display: inline-block;
  border: 0;
  font-family: inherit;
  font-size: inherit;
  white-space: nowrap;
  cursor: pointer;
}

/* --- FIL --- */
h1.thread-title {
  font-size: 2rem;
  overflow-wrap: anywhere;
}

/* Premier message encadré : marge égale autour du message */
.comment-row:has(> .comment-row) {
  padding: 12px;
  border-radius: 16px;
}

.comment-row > .comment-row {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

/* Colonne auteur un peu plus large : un pseudo usuel tient sur une ligne */
.comment-sidebar {
  width: 160px;
}

.comment-author-name {
  overflow-wrap: anywhere;
}

/* Corps des messages : texte brut dont on garde les retours à la ligne, médias contenus */
.comment-body {
  min-width: 0;
}

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

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

/* Le moteur entoure les vidéos de <br> : inutiles avec pre-line */
.comment-content br:has(+ iframe),
.comment-content iframe + br {
  display: none;
}

.comment-content iframe {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
}

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

.logo-area img {
  flex-shrink: 0;
}

.site-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* --- PROFIL --- */
.profile-avatar {
  flex-shrink: 0;
}

.profile-info {
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-stats {
  flex-wrap: wrap;
}

.profile-col {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Derniers sujets et réponses : le moteur les place dans un seul <li>, une carte par élément */
.activity-list > li > div {
  background: var(--bg-card);
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.activity-list .comment-thread-title {
  line-height: 1.4;
}

.activity-list > li > div > .comment-date:first-child {
  margin-top: 0;
}

/* Extrait du message : retours à la ligne conservés, médias contenus (comme dans le fil) */
.comment {
  white-space: pre-line;
}

.comment br:has(+ iframe),
.comment iframe + br {
  display: none;
}

.comment iframe {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  aspect-ratio: 16 / 9;
  margin-top: 10px;
  border: 0;
  border-radius: 8px;
}

.comment img,
.comment video {
  max-width: 100%;
  height: auto;
}

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

/* ---=== Mobile ===--- */
@media (max-width: 1024px) {
  header {
    padding: 10px 0;
  }

  .header-container {
    flex-wrap: wrap;
    gap: 10px 20px;
  }

  .logo-area {
    flex: 1 1 auto;
    min-width: 0;
  }

  nav {
    order: 3;
    flex-basis: 100%;
    display: flex;
    justify-content: center;
  }
}

@media (max-width: 900px) {
  .forum-item {
    display: grid;
    grid-template-columns: 48px auto auto minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 8px;
    padding: 16px 18px;
  }

  .forum-avatar {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    margin-right: 0;
  }

  .forum-subject {
    grid-column: 2 / -1;
    grid-row: 1;
    padding-right: 0;
  }

  .forum-author {
    grid-column: 2;
    grid-row: 2;
    max-width: none;
    text-align: left;
  }

  .forum-messages {
    grid-column: 3;
    grid-row: 2;
    justify-self: start;
    margin: 0;
  }

  .forum-last-message {
    grid-column: 4;
    grid-row: 2;
    width: auto;
  }

  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }

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

@media (max-width: 600px) {
  header {
    position: relative;
  }

  .header-container {
    padding: 0 16px;
    justify-content: center;
  }

  .logo-area {
    flex-basis: 100%;
    justify-content: center;
  }

  .site-title {
    font-size: 1.05rem;
    line-height: 1.3;
    text-align: center;
  }

  nav a {
    display: inline-block;
    padding: 6px 14px;
  }

  .banner-container {
    height: 180px;
  }

  .main-container {
    padding: 0 16px;
  }

  .forum-section > a > .forum-header {
    font-size: 1.3rem;
  }

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

  .forum-avatar {
    width: 40px;
    height: 40px;
    grid-row: 1 / span 3;
  }

  .forum-subject {
    font-size: 1rem;
  }

  .forum-messages {
    justify-self: end;
  }

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

  h1.thread-title {
    font-size: 1.5rem;
  }

  .comment-row {
    flex-direction: column;
    gap: 10px;
  }

  .comment-row:has(> .comment-row) {
    padding: 8px;
  }

  .comment-sidebar {
    width: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-align: left;
  }

  .comment-sidebar > a:first-child {
    flex-shrink: 0;
    line-height: 0;
  }

  .comment-avatar-large {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
  }

  .comment-author-name {
    margin-bottom: 0;
    min-width: 0;
  }

  .comment-meta {
    padding: 8px 16px;
  }

  .comment-content {
    padding: 16px;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 24px 16px;
  }

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

  .profile-stats {
    justify-content: center;
    gap: 8px 10px;
  }

  .profile-info h1 {
    font-size: 1.6rem;
    line-height: 1.2;
  }

  .profile-col h3 {
    font-size: 1.15rem;
  }

  .activity-list > li > div {
    padding: 12px 14px;
  }

  footer {
    padding: 40px 0 24px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 0 16px;
  }

  .footer-bottom {
    margin-top: 30px;
    padding: 20px 16px 0;
  }
}
