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

:root {
  /* Polices */
  --font-main: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Couleurs de Fond */
  --color-bg: #0f0f1a;
  --color-black-trans-10: rgba(0, 0, 0, 0.1);

  /* Couleurs "Aurora" */
  --color-aurora-1: #7f00ff;
  --color-aurora-2: #00a3ff;
  --color-aurora-3: #ff007a;
  --color-aurora-1-trans-10: rgba(127, 0, 255, 0.1);
  --color-aurora-3-trans-10: rgba(255, 0, 122, 0.1);

  /* Ombres */
  --color-aurora-3-shadow: rgba(255, 0, 122, 0.3);
  --color-aurora-3-shadow-hover: rgba(255, 0, 122, 0.4);

  /* Glassmorphism */
  --color-glass-bg: rgba(255, 255, 255, 0.05);
  --color-glass-border: rgba(255, 255, 255, 0.2);
  --color-glass-hover: rgba(255, 255, 255, 0.1);

  /* Textes */
  --color-text-primary: #ffffff;
  --color-text-secondary: #a0a0c0;

  /* Divers */
  --color-transparent: transparent;
  --gradient-aurora-1-3: linear-gradient(135deg, var(--color-aurora-1), var(--color-aurora-3));
  --gradient-aurora-2-1: linear-gradient(135deg, var(--color-aurora-2), var(--color-aurora-1));
  --gradient-aurora-trans-1-3: linear-gradient(135deg, var(--color-aurora-1-trans-10), var(--color-aurora-3-trans-10));
  /* Texte posé sur le dégradé des boutons pleins */
  --color-on-gradient: #ffffff;
}

/* --- Reset & Globaux --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
  min-height: 100%;
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.6;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* --- Background Aurora --- */
.aurora-background {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: -1; overflow: hidden;
  filter: blur(100px) saturate(150%); opacity: 0.3;
}
.aurora-background::before, .aurora-background::after {
  content: ""; position: absolute; border-radius: 50%;
}
.aurora-background::before {
  width: 600px; height: 600px; background: var(--gradient-aurora-1-3);
  top: -100px; left: -200px; animation: moveAurora 20s infinite alternate;
}
.aurora-background::after {
  width: 500px; height: 500px; background: var(--gradient-aurora-2-1);
  bottom: -100px; right: -150px; animation: moveAurora 15s infinite alternate-reverse;
}
@keyframes moveAurora {
  from { transform: translate(0, 0) rotate(0deg); }
  to { transform: translate(100px, 50px) rotate(45deg); }
}

main, .page-content-wrapper { flex: 1 0 auto; z-index: 1; }
a { color: var(--color-text-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-text-secondary); }
img { max-width: 100%; height: auto; display: block; }

/* --- Boutons --- */
.btn {
  display: inline-block; padding: 8px 18px; border-radius: 8px;
  font-weight: 600; font-size: 0.9rem; cursor: pointer; border: 1px solid transparent;
}
.btn-primary {
  background: var(--gradient-aurora-1-3); color: var(--color-on-gradient);
  box-shadow: 0 4px 15px var(--color-aurora-3-shadow);
}
.btn-primary:hover { opacity: 0.9; color: var(--color-on-gradient); }
.btn-secondary {
  background: var(--color-glass-bg); border-color: var(--color-glass-border);
}
.btn-secondary:hover { background: var(--color-glass-hover); }

/* --- Header --- */
.site-header {
  background: var(--color-glass-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-glass-border);
  position: sticky; top: 0; z-index: 100;
}
.header-nav {
  min-height: 70px; max-width: 1200px; margin: 0 auto; padding: 8px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.header-left, .logo-link { display: flex; align-items: center; }
.logo-link img { height: 40px; width: auto; max-width: 120px; object-fit: contain; margin-right: 12px; flex-shrink: 0; }
.logo-link { min-width: 0; }
.site-name { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.nav-links { display: flex; margin-left: 20px; gap: 15px; }
.nav-link { font-weight: 600; color: var(--color-text-secondary); padding: 5px; }
.nav-link:hover, .nav-link.active { color: var(--color-text-primary); }
.header-center { flex-grow: 1; display: flex; justify-content: center; }
.search-bar { position: relative; width: 100%; max-width: 350px; }
.search-bar input {
  width: 100%; padding: 8px 15px 8px 35px; border-radius: 20px;
  background: var(--color-glass-bg); border: 1px solid var(--color-glass-border);
  color: var(--color-text-primary); backdrop-filter: blur(5px);
}
.search-bar i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-secondary); }
.header-right { display: flex; gap: 10px; flex-shrink: 0; }

/* --- Bannière --- */
.banner-container {
  background: var(--color-glass-bg);
  border-bottom: 1px solid var(--color-glass-border);
}
.banner-container img {
  width: 100%; max-height: 250px; object-fit: cover;
}

/* =================================================================
   --- BREADCRUMB ---
================================================================= */
.breadcrumb-bar {
  background: var(--color-glass-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-glass-border);
}
.breadcrumb-container {
  max-width: 1200px; margin: 0 auto; padding: 12px 20px;
  overflow-wrap: anywhere;
}

.breadcrumb-item {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text-secondary);
}

.breadcrumb-item:hover {
  color: var(--color-aurora-2);
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--color-aurora-2);
  margin: 0 8px;
  font-weight: bold;
}

/* =================================================================
   --- PAGE USER (Amélioration du design) ---
================================================================= */
.page-content-wrapper {
  max-width: 1200px;
  margin: 30px auto 40px auto;
  padding: 0 20px;
  width: 100%;
}

.profile-card {
  background: var(--color-glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--color-glass-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* En-tête du profil */
.profile-header {
  padding: 35px;
  background: var(--gradient-aurora-trans-1-3);
  display: flex;
  align-items: center;
  gap: 25px;
  border-bottom: 1px solid var(--color-glass-border);
}

.profile-avatar {
  width: 110px; height: 110px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.1);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  object-fit: cover;
}

.profile-pseudo {
  font-size: 2.5rem;
  margin-bottom: 0;
  line-height: 1.2;
}

.profile-realname {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* Corps (Infos + Stats) */
.profile-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--color-glass-border);
}

.profile-info, .profile-stats { padding: 30px; }
.profile-stats { 
    border-left: 1px solid var(--color-glass-border);
    background: rgba(0,0,0,0.02); 
}

.profile-section-title {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-aurora-2);
  display: inline-block;
}

.profile-info ul { list-style: none; }
.profile-info li { margin-bottom: 10px; font-size: 0.95rem; }
.profile-info strong { color: var(--color-aurora-2); margin-right: 8px; }

.stats-grid { display: flex; gap: 40px; }
.stat-item { display: flex; flex-direction: column; }
.stat-value {
  font-size: 2.2rem; font-weight: 700;
  background: var(--gradient-aurora-1-3);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 0.9rem; color: var(--color-text-secondary); }

/* Activité (Stylisation des div génériques) */
.profile-activity { padding: 30px; }
.activity-section { margin-bottom: 30px; }
.activity-section:last-child { margin-bottom: 0; }
.activity-section h4 { font-size: 1.1rem; margin-bottom: 15px; }

.activity-list { display: flex; flex-direction: column; gap: 15px; }

/* Cible les items d'activité (div sans classe dans le DOM) */
.activity-list > div {
  background: var(--color-glass-hover);
  border: 1px solid var(--color-glass-border);
  border-radius: 10px;
  padding: 15px 20px;
  transition: transform 0.2s, background 0.2s;
}

.activity-list > div:hover {
  background: var(--color-glass-bg);
  transform: translateY(-2px);
  border-color: var(--color-aurora-2);
}

.comment-date {
  font-size: 0.8rem; color: var(--color-text-secondary);
  margin-bottom: 5px; font-weight: 600;
}

.comment-thread-title a {
  font-size: 1rem; color: var(--color-text-primary); font-weight: 700;
}
.comment-thread-title a:hover { color: var(--color-aurora-2); }

.comment {
  font-size: 0.9rem; color: var(--color-text-secondary);
  font-style: italic; margin-top: 8px;
  padding-left: 10px; border-left: 3px solid var(--color-aurora-3);
}

/* --- Footer --- */
.site-footer {
  margin-top: auto; border-top: 1px solid var(--color-glass-border);
  background: var(--color-glass-bg); padding: 30px 0;
}
.footer-content {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.footer-links a, .footer-socials a, .copyright { color: var(--color-text-secondary); }
.footer-links a:hover, .footer-socials a:hover { color: var(--color-aurora-2); }
.footer-links a { margin-right: 15px; }
.footer-socials a { margin-left: 10px; font-size: 1.2rem; }
/* Icônes Font Awesome jamais chargées par head.html : liens vides masqués */
.footer-socials { display: none; }

/* ---=== Balisage généré par Forum.php : .forum-section > a > h2.forum-header + .forum-item ===--- */
/* Aucune règle ne stylait ces classes : avatars en taille réelle et fils en texte brut. Carte
   « verre » du modèle, avatar à gauche, sujet et messages en haut, auteur et date en dessous
   (cf. docs/forums_generation.md §7). */
.forum-section {
  background: var(--color-glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--color-glass-border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 25px;
  transition: background-color 0.3s;
}
.forum-section:hover { background-color: var(--color-glass-hover); }
.forum-section > a { display: block; }
/* Le h2 porte aussi .breadcrumb-item : on rétablit la taille et la couleur d'un titre */
.forum-section > a > .forum-header {
  display: block;
  padding: 15px 20px;
  border-bottom: 1px solid var(--color-glass-border);
  font-size: 1.3rem;
  line-height: 1.3;
  color: var(--color-text-primary);
  overflow-wrap: anywhere;
}
.forum-section > a:hover > .forum-header {
  color: var(--color-aurora-2);
  text-decoration: none;
}

/* La date occupe deux colonnes : le sujet ne cède que la largeur de « N messages » */
.forum-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  grid-template-areas:
    "avatar subject subject      messages"
    "avatar author  last-message last-message";
  gap: 2px 15px;
  align-items: start;
  padding: 15px 20px;
  border-top: 1px solid var(--color-glass-border);
}
.forum-section > a + .forum-item { border-top: none; }
.forum-item .forum-avatar {
  grid-area: avatar;
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--color-glass-border);
  margin-top: 2px;
}
.forum-subject {
  grid-area: subject;
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text-primary);
  overflow-wrap: anywhere;
}
.forum-subject:hover { text-decoration: underline; }
.forum-author {
  grid-area: author;
  min-width: 0;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}
.forum-author a { color: var(--color-text-secondary); }
.forum-author a:hover { color: var(--color-text-primary); }
.forum-messages {
  grid-area: messages;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-primary);
  text-align: right;
  white-space: nowrap;
  padding-top: 2px;
}
.forum-last-message {
  grid-area: last-message;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  text-align: right;
  white-space: nowrap;
}

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

/* Pagination de catégorie générée par Forum.php : <span class="current-page"> + <a class="page-link"> */
.pagination:not(:has(.page-link)) { display: none; }
.pagination {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px;
}
.pagination .current-page,
.pagination .page-link {
  display: inline-block; min-width: 2.2rem; padding: 5px 12px;
  border-radius: 8px; text-align: center; font-size: 0.9rem;
  border: 1px solid var(--color-glass-border);
}
.pagination .page-link {
  background: var(--color-glass-bg); color: var(--color-text-secondary);
}
.pagination .page-link:hover {
  background: var(--color-glass-hover); color: var(--color-text-primary);
}
.pagination .current-page {
  background: var(--gradient-aurora-1-3); color: var(--color-on-gradient);
  border-color: transparent; font-weight: 700;
}

/* --- Page fil : carte « postbit », pseudo et avatar à gauche --- */
.thread-title {
  font-size: 2rem;
  line-height: 1.3;
  margin-bottom: 20px;
  overflow-wrap: anywhere;
}
.comments-list { display: flex; flex-direction: column; gap: 20px; }
.comment-post {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  background: var(--color-glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--color-glass-border);
  border-radius: 12px;
  overflow: hidden;
}
.comment-user-info {
  padding: 20px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  border-right: 1px solid var(--color-glass-border);
  background: var(--color-black-trans-10);
  min-width: 0;
}
.comment-pseudo {
  font-size: 1.1rem; font-weight: 700;
  max-width: 100%; overflow-wrap: anywhere;
}
.comment-avatar {
  width: 90px; height: 90px; object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--color-glass-border);
  margin-top: 10px;
}
.comment-content-container { padding: 20px; min-width: 0; }
.comment-meta {
  padding-bottom: 10px; margin-bottom: 15px;
  border-bottom: 1px solid var(--color-glass-border);
}
.comment-meta .comment-date { font-size: 0.85rem; margin-bottom: 0; }
/* Message en texte brut : on garde ses retours à la ligne */
.comment-body {
  white-space: pre-line;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.comment-body a {
  color: var(--color-aurora-2); font-weight: 700;
  border-bottom: 1px dotted var(--color-aurora-2);
}
.comment-body a:hover { color: var(--color-text-primary); }
.comment-body img,
.comment-body video { max-width: 100%; height: auto; }
.comment-body pre { white-space: pre-wrap; }
/* Le moteur entoure les vidéos de <br> : inutiles avec pre-line */
.comment-body br:has(+ iframe),
.comment-body iframe + br { display: none; }
.comment-body iframe {
  display: inline-block; vertical-align: top;
  width: 100%; max-width: 560px;
  height: auto; aspect-ratio: 16 / 9;
  border: 0; border-radius: 8px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .site-header { position: relative; }
  .header-nav { flex-wrap: wrap; padding: 12px 16px; gap: 12px 16px; }
  .header-left { flex: 1 1 100%; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
  .nav-links { margin-left: 0; }
  .header-center { flex: 1 1 220px; justify-content: flex-start; }
  .search-bar { max-width: none; }
  .header-right { flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 800px) {
  .profile-header { flex-direction: column; text-align: center; }
  .profile-pseudo { font-size: 2rem; overflow-wrap: anywhere; }
  .profile-body { grid-template-columns: 1fr; }
  .profile-stats { border-left: none; border-top: 1px solid var(--color-glass-border); }
  .footer-content { flex-direction: column; gap: 20px; text-align: center; }
  .footer-links a { margin: 0 8px; }
}

/* Mobile */
@media (max-width: 600px) {
  .header-right { flex: 1 1 100%; }
  .breadcrumb-container { padding: 10px 16px; }
  .page-content-wrapper { margin-top: 20px; padding: 0 16px; }
  .forum-section > a > .forum-header { padding: 12px 16px; font-size: 1.2rem; }
  .forum-item {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas:
      "avatar subject      subject"
      "avatar author       messages"
      "avatar last-message last-message";
    gap: 4px 12px;
    padding: 12px 16px;
  }
  .forum-item .forum-avatar { width: 40px; height: 40px; }
  .forum-subject { font-size: 1rem; }
  .forum-messages { padding-top: 0; }
  .forum-last-message { text-align: left; white-space: normal; font-size: 0.85rem; }
  .pagination { justify-content: center; }
  .thread-title { font-size: 1.5rem; }
  .comment-post { grid-template-columns: minmax(0, 1fr); }
  .comment-user-info {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 12px 16px; text-align: left;
    border-right: none; border-bottom: 1px solid var(--color-glass-border);
  }
  .comment-avatar { order: -1; width: 48px; height: 48px; margin-top: 0; border-width: 2px; }
  .comment-content-container { padding: 16px; }
  .profile-header { padding: 25px 16px; }
  .profile-info, .profile-stats, .profile-activity { padding: 20px 16px; }
  .stats-grid { gap: 25px; }
}
