/* =================================================
   VARIABLES GLOBALES
================================================= */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed: 70px;
  --sponsor-width: 320px;

  --panel: #0d0d0d;
  --border: #222;
  --background: #121212;
  --accent: #f54141;
  --text: #eee;
}

/* =================================================
   RESET GLOBAL
================================================= */
body { 
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, sans-serif;
}

/* =================================================
   SIDEBAR (DESKTOP)
================================================= */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: all 0.25s ease;
}

/* =================================================
   LOGO
================================================= */
#sidebar .logo {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 30px;
  color: var(--accent);
}

/* =================================================
   NAV
================================================= */
#sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* =================================================
   MENU ITEM
================================================= */
#sidebar .menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  position: relative;
  transition: background 0.2s ease;
}

#sidebar .menu-item:hover {
  background: #1a1a1a;
}

#sidebar .menu-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* =================================================
   ICON + LABEL
================================================= */
.menu-item .icon {
  font-size: 20px;
  min-width: 26px;
  text-align: center;
}

.menu-item .label {
  white-space: nowrap;
}

/* =================================================
   COLLAPSED MODE (DESKTOP)
================================================= */
body.sidebar-collapsed #sidebar {
  width: var(--sidebar-collapsed);
}

/* centre icônes */
body.sidebar-collapsed #sidebar .menu-item {
  justify-content: center;
  padding: 12px 0;
}

/* cache texte */
body.sidebar-collapsed #sidebar .label {
  display: none;
}

/* cache texte logo */
body.sidebar-collapsed #sidebar .logo .label {
  display: none;
}

/* =================================================
   TOOLTIP (OPTIONNEL)
================================================= */
body.sidebar-collapsed #sidebar .menu-item::after {
  content: attr(data-label);
  position: absolute;
  left: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: #111;
  color: white;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

body.sidebar-collapsed #sidebar .menu-item:hover::after {
  opacity: 1;
}

/* =================================================
   MAIN CONTENT
================================================= */
#main {
  margin-left: var(--sidebar-width);
  margin-right: var(--sponsor-width);
  padding: 20px;
  transition: all 0.25s ease;
}

body.sidebar-collapsed #main {
  margin-left: var(--sidebar-collapsed);
}

/* =================================================
   SPONSOR (DROITE)
================================================= */
#sponsor {
  position: fixed;
  top: 0; /* FIX espace vide */
  right: 0;
  width: var(--sponsor-width);
  height: 100vh;
  background: #111;
  border-left: 1px solid var(--border);
  padding: 15px;
  overflow-y: auto;
  box-sizing: border-box;
  z-index: 10;
}

/* ADS */
.ad-box {
  background: #1a1a1a;
  padding: 15px;
  border-radius: 12px;
  text-align: center;
  margin-top: 10px;
}

#ad-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
}

#ad-title {
  font-size: 16px;
  margin-bottom: 8px;
  color: white;
}

#ad-text {
  font-size: 14px;
  color: #ccc;
}

#ad-btn {
  margin-top: 10px;
  padding: 8px 12px;
  border: none;
  background: orange;
  color: black;
  cursor: pointer;
  border-radius: 6px;
  font-weight: bold;
}

#ad-btn:hover {
  opacity: 0.8;
}

/* =================================================
   STORIES
================================================= */
.stories-bar {
  width: 100%;
}

/* =================================================
   MODAL COMMENTAIRES CORRIGÉ
================================================= */
#comment-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 15px;
}

#comment-modal .comment-modal-content {
  background: var(--panel);
  border: 1px solid #333;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#comment-modal #close-comments {
  align-self: flex-end;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text);
}

#modal-comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid #333;
}

/* Chaque commentaire */
.comment-item {
  display: flex;
  gap: 10px;
  background: #1e1e1e;
  padding: 8px;
  border-radius: 8px;
}

.comment-item .comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-item div {
  flex: 1;
}

.comment-item b {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
  color: var(--accent);
}

.comment-item p {
  margin: 0;
  word-wrap: break-word;
  color: var(--text);
}

/* Zone ajout commentaire */
.add-comment {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid #333;
  background: #0d0d0d;
}

#modal-comment-input {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #333;
  background: #1e1e1e;
  color: var(--text);
  box-sizing: border-box;
}

#modal-comment-send {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #333;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

#modal-comment-send:hover {
  opacity: 0.85;
}

/* =================================================
   RESPONSIVE TABLET
================================================= */
@media (max-width: 1100px) {
  #sponsor { display: none; }

  #main {
    margin-right: 0;
  }
}

/* =================================================
   MOBILE
================================================= */
@media (max-width: 768px) {

  /* cache sidebar hors écran */
  #sidebar {
    position: fixed;
    left: -100%;
  }

  /* sidebar ouverte */
  #sidebar.active {
    left: 0;
  }

  /* 🔥 empêche scroll horizontal */
  body {
    overflow-x: hidden;
  }

  /* 🔥 plein écran réel */
  #main {
    margin: 0 !important;
    width: 100%;
    max-width: 100%;
    padding: 10px;
  }

  /* 🔥 IMPORTANT aussi */
  #sponsor {
    display: none;
  }
}