/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Variables — Light (défaut) ── */
:root {
  --bg:        #f8f8f6;
  --bg-alt:    #ffffff;
  --border:    #e0e0dc;
  --text:      #1a1a1a;
  --text-muted:#666;
  --accent:    #2c6e49;
  --accent2:   #1d4e89;
  --warn:      #8b2e2e;
  --warn-bg:   #fdf4f4;
  --tip-bg:    #f4faf6;
  --note-bg:   #f4f7fd;
  --sidebar-w: 270px;
  --radius:    0px;
  --shadow:    0 1px 3px rgba(0,0,0,.08);
}

/* ── Variables — Dark ── */
[data-theme="dark"] {
  --bg:        #0f1117;
  --bg-alt:    #1a1d27;
  --border:    #2a2d3a;
  --text:      #e8e8e4;
  --text-muted:#8a8fa8;
  --accent:    #4ade80;
  --accent2:   #60a5fa;
  --warn:      #f87171;
  --warn-bg:   #2a1a1a;
  --tip-bg:    #0f2318;
  --note-bg:   #0f1a2e;
  --shadow:    0 1px 4px rgba(0,0,0,.4);
}

/* code/pre en dark */
[data-theme="dark"] code {
  background: #1e2130;
  border-color: var(--border);
  color: #c9d1d9;
}
[data-theme="dark"] pre {
  background: #161b22;
  border-color: var(--border);
}
[data-theme="dark"] kbd {
  background: #2a2d3a;
  border-color: #3a3d4a;
  color: var(--text);
}

/* ── Bouton dark mode toggle ── */
#dark-mode-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 10px;
  margin-top: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all .15s;
  text-align: left;
}
#dark-mode-btn:hover { background: var(--bg); color: var(--text); border-color: var(--accent); }
#dark-mode-btn i { width: 14px; text-align: center; font-size: 12px; }

/* ── Base ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent); }

strong { font-weight: 600; }
code {
  font-family: 'Courier New', monospace;
  background: #f0f0ee;
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: var(--radius);
  font-size: 13px;
  color: #333;
}
pre {
  background: #f5f5f3;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: var(--radius);
  margin: 16px 0;
}
pre code { background: none; border: none; padding: 0; font-size: 13px; }

kbd {
  background: #eee;
  border: 1px solid #ccc;
  border-bottom: 2px solid #bbb;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: monospace;
}

/* ── Layout ── */
.container { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.sidebar-logo i { color: var(--accent); font-size: 20px; }

.lang-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
.lang-switch a,
.lang-switch span {
  flex: 1;
  text-align: center;
  padding: 5px 0;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all .15s;
}
.lang-switch a:hover { border-color: var(--accent); color: var(--accent); background: var(--tip-bg); }
.lang-switch span.active { border-color: var(--accent); color: var(--accent); background: var(--tip-bg); font-weight: 600; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 14px 6px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-section-label i { font-size: 10px; }

.sidebar nav ul { list-style: none; }
.sidebar nav li { margin: 1px 0; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 13px;
  border-radius: var(--radius);
  transition: all .15s;
  text-decoration: none;
}
.sidebar nav a i { width: 14px; text-align: center; font-size: 12px; flex-shrink: 0; }
.sidebar nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--tip-bg); color: var(--accent); font-weight: 600; }
.sidebar nav a.active i { color: var(--accent); }

/* ── Content ── */
.content {
  margin-left: var(--sidebar-w);
  padding: 40px 48px 60px;
  flex: 1;
  max-width: 860px;
}

.content h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.content h1 i { color: var(--accent); font-size: 22px; }

.content h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-top: 36px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.content h2 i { color: var(--accent); font-size: 15px; }

.content h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-top: 20px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.content h3 i { color: var(--text-muted); font-size: 12px; }

.content p { margin-bottom: 12px; color: var(--text); }
.content ul, .content ol { margin: 8px 0 12px 24px; }
.content li { margin-bottom: 5px; }

/* ── Info boxes ── */
.info-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-alt);
}
.info-box.warning  { background: var(--warn-bg);  border-color: #e8c4c4; }
.info-box.tip      { background: var(--tip-bg);   border-color: #b8dfc8; }
.info-box.note     { background: var(--note-bg);  border-color: #b8cce8; }

.info-box i.box-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.info-box.warning  i.box-icon { color: var(--warn); }
.info-box.tip      i.box-icon { color: var(--accent); }
.info-box.note     i.box-icon { color: var(--accent2); }

.info-box h4 { font-size: 13px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.info-box p  { margin: 0; font-size: 13px; color: #444; }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table th {
  background: #f2f2f0;
  color: var(--text);
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--bg); }
table td a { color: var(--accent2); }

/* ── Images ── */
.guide-img {
  display: block;
  max-width: 90%;
  border: 1px solid var(--border);
  margin: 20px auto;
  box-shadow: var(--shadow);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.img-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  transition: box-shadow .15s;
}
.img-card:hover { box-shadow: var(--shadow); }
.img-card img {
  width: 48px;
  height: 48px;
  display: block;
  margin: 0 auto 6px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.img-card span { display: block; line-height: 1.3; }
.img-card a { color: var(--text-muted); text-decoration: none; }
.img-card a:hover { color: var(--accent2); }

/* ── AdSense — discret ── */
.ad-slot {
  margin: 32px 0;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
  opacity: 0.9;
}
.ad-label {
  font-size: 9px;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  display: block;
}
.ad-slot-sidebar {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  opacity: 0.9;
}

/* ── Canvas animations Minecraft ── */
canvas.mc-anim {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 0px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 20px 16px; }
}

/* ══════════════════════════════════════════════════════
   CMS USER BAR — redesign + mobile
   ══════════════════════════════════════════════════════ */

.cms-user-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
  padding: 10px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Ligne username en haut, bien visible */
.cms-user-bar > a:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cms-user-bar > a:first-child i {
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
}
.cms-user-bar > a:first-child:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* Grille d'icônes pour les actions — HORIZONTAL */
.cms-user-bar-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.cms-user-bar-actions a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 13px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all .15s;
  position: relative;
  flex-shrink: 0;
}
.cms-user-bar-actions a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--tip-bg);
  text-decoration: none;
}
.cms-user-bar-actions a.action-admin {
  border-color: #e8c4c4;
  color: #c0392b;
}
.cms-user-bar-actions a.action-admin:hover {
  background: #fdf4f4;
  border-color: #c0392b;
}
.cms-user-bar-actions a.action-logout:hover {
  border-color: #c0392b;
  color: #c0392b;
  background: #fdf4f4;
}

/* Tooltip au survol */
.cms-user-bar-actions a[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 999;
}

/* Liens login/register (non connecté) */
.cms-user-bar-guest {
  display: flex;
  gap: 6px;
}
.cms-user-bar-guest a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all .15s;
}
.cms-user-bar-guest a:first-child {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--tip-bg);
}
.cms-user-bar-guest a:hover { border-color: var(--accent2); color: var(--accent2); text-decoration: none; }

/* ══════════════════════════════════════════════════════
   MOBILE — header sticky + sidebar drawer
   ══════════════════════════════════════════════════════ */

.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
}
.mobile-header-logo {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-header-logo i { color: var(--accent); }
.mobile-header-logo a { color: inherit; text-decoration: none; }

.mobile-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.mobile-header-actions a,
.mobile-header-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 14px;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  flex-shrink: 0;
}
.mobile-header-actions a:hover,
.mobile-header-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.mobile-header-actions a.action-admin { color: #c0392b; border-color: #e8c4c4; }
#mobile-menu-btn { font-size: 16px; }

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 998;
}
#sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  /* Afficher le header mobile */
  .mobile-header { display: flex; }

  /* Pousser le contenu sous le header */
  body { padding-top: 52px; }

  /* Sidebar devient un drawer */
  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    height: 100vh;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform .25s ease;
    padding-top: 16px;
    box-shadow: 2px 0 12px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }

  /* Masquer le user-bar dans le drawer — les actions sont dans le header mobile */
  .sidebar .cms-user-bar { display: none; }

  /* Contenu pleine largeur */
  .content {
    margin-left: 0;
    padding: 20px 16px 40px;
  }

  /* Tables scrollables */
  table { display: block; overflow-x: auto; }

  /* Reply cards empilées */
  .reply-card { flex-direction: column; }
  .reply-author {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    padding: 10px 14px;
  }
  .reply-author .avatar-circle { margin: 0; width: 32px; height: 32px; font-size: 13px; }

  /* Forum cat grid */
  .forum-cat-card { padding: 12px 14px; }

  /* Profile layout */
  .profile-layout { grid-template-columns: 1fr; }
}
