/* Reset + variables inherited from common.css */

/* ─── ADMIN BAR ─── */
#admin-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 300;
  background: #1a1f27;
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
}
#admin-bar a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
#admin-bar a:hover { text-decoration: underline; }
body.has-admin-bar .sidebar { top: 34px; }
body.has-admin-bar .content-wrap { padding-top: 34px; }
@media (max-width: 768px) {
  body.has-admin-bar .content-wrap { padding-top: calc(34px + 49px); }
  body.has-admin-bar .mobile-header { top: 34px; }
}

body {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── SIDEBAR ─── */
/* Les styles de base (.sidebar) sont dans common.css */
.sidebar {
  /* Spécifique à l'accueil : position fixe */
  position: fixed;
  top: 0; left: 0; bottom: 0;
  min-height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease, background 0.2s, border-color 0.2s;
}

/* .sidebar-header et .sidebar-header img — définis dans common.css */
.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text-light);
  padding: 0 20px;
  margin: 16px 0 6px;
}

/* Search */
.search-box { padding: 12px 16px; }
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--sidebar-input-bg);
  color: var(--sidebar-text);
  outline: none;
  font-family: inherit;
  position: relative;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,191,255,0.15); }

/* Nav */
.sidebar-nav { padding: 8px 0 24px; }
.category-group { margin-bottom: 4px; }
.category-title {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  font-size: 13px; font-weight: 600;
  color: var(--sidebar-text);
  cursor: pointer;
  user-select: none;
}
.category-title:hover { color: var(--primary); }
.category-articles { padding-left: 8px; }
.article-link {
  display: block;
  padding: 6px 20px 6px 28px;
  font-size: 13px;
  color: var(--sidebar-text-light);
  text-decoration: none;
  border-radius: 6px;
  margin: 1px 8px;
  transition: all 0.15s;
  cursor: pointer;
}
.article-link:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text); }
.article-link.active {
  background: rgba(0,191,255,0.2);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  font-weight: 500;
  padding-left: 25px;
}

/* Search results */
.search-results {
  padding: 0 8px;
  display: none;
}
.search-results.visible { display: block; }
.search-result-item {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.search-result-item:hover { background: var(--sidebar-hover-bg); }
.search-result-item .res-title { font-size: 13px; font-weight: 500; color: var(--sidebar-text); }
.search-result-item .res-cat { font-size: 11px; color: var(--sidebar-text-light); }

/* ─── CONTENT ─── */
.content-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  min-height: 100vh;
  background: var(--content-bg);
}

.content {
  flex: 1;
  padding: 48px 72px;
  width: 100%;
  min-width: 0;
}

/* Article styles */
.article-meta {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.article-meta .tag {
  background: rgba(0,191,255,0.1);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.article-admin-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.btn-edit-article, .btn-delete-article {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  border: 1px solid;
}
.btn-edit-article {
  background: rgba(0,191,255,0.08);
  color: var(--primary);
  border-color: rgba(0,191,255,0.3);
}
.btn-edit-article:hover { background: rgba(0,191,255,0.18); }
.btn-delete-article {
  background: rgba(239,68,68,0.07);
  color: #ef4444;
  border-color: rgba(239,68,68,0.25);
}
.btn-delete-article:hover { background: rgba(239,68,68,0.15); }

.article-body { font-size: 1.05rem; line-height: 1.8; color: var(--text); }
.article-body h1 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 2rem; font-weight: 800; margin: 2.5rem 0 1rem; color: var(--dark); scroll-margin-top: 24px; }
.article-body h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.5rem; font-weight: 700; margin: 2.5rem 0 1rem; color: var(--dark); padding-bottom: 0.5rem; border-bottom: 2px solid var(--h2-border); scroll-margin-top: 24px; }
.article-body h3 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.15rem; font-weight: 600; margin: 1.75rem 0 0.75rem; color: var(--h3-color); scroll-margin-top: 24px; }
.article-body p { margin-bottom: 1.2rem; }
.article-body ul, .article-body ol { margin: 0.75rem 0 1.2rem 1.5rem; }
.article-body li { margin-bottom: 0.4rem; }
.article-body strong { font-weight: 600; color: var(--dark); }
.article-body a { color: var(--primary); text-decoration: underline; }
.article-body code { background: var(--code-bg); color: var(--code-color); padding: 2px 8px; border-radius: 4px; font-size: 0.9em; font-family: 'Courier New', monospace; }
.article-body pre { background: var(--pre-bg); color: var(--pre-color); padding: 1.5rem; border-radius: 12px; overflow-x: auto; margin: 1.5rem 0; line-height: 1.6; position: relative; }
.copy-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { background: rgba(255,255,255,0.2); }
.copy-btn.copied { background: rgba(34,197,94,0.3); border-color: #22c55e; color: #86efac; }
.article-body pre code { background: none; color: inherit; padding: 0; font-size: 0.9em; }
.article-body blockquote { display: flex; align-items: flex-start; gap: 10px; border-left: 4px solid var(--primary); background: var(--blockquote-bg); padding: 0.75rem 1rem; border-radius: 0 8px 8px 0; margin: 1rem 0; color: var(--text); font-style: normal; font-size: 0.92rem; line-height: 1.6; }
.article-body blockquote p { margin: 0; }
.article-body blockquote.alert-warning { border-left-color: #f59e0b; background: #fffbeb; color: #78350f; }
.article-body blockquote.alert-info    { border-left-color: #3b82f6; background: #eff6ff; color: #1e3a5f; }
.article-body blockquote.alert-success { border-left-color: #22c55e; background: #f0fdf4; color: #14532d; }
.article-body blockquote.alert-danger  { border-left-color: #ef4444; background: #fef2f2; color: #7f1d1d; }

[data-theme="dark"] .article-body blockquote.alert-warning { background: rgba(245,158,11,0.12); color: #fcd34d; }
[data-theme="dark"] .article-body blockquote.alert-info    { background: rgba(59,130,246,0.12); color: #93c5fd; }
[data-theme="dark"] .article-body blockquote.alert-success { background: rgba(34,197,94,0.12);  color: #86efac; }
[data-theme="dark"] .article-body blockquote.alert-danger  { background: rgba(239,68,68,0.12);  color: #fca5a5; }
.article-body hr { border: none; border-top: 2px solid var(--border); margin: 2rem 0; }
.article-body .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.5rem 0; }
.article-body table { width: 100%; border-collapse: collapse; font-size: 0.95rem; min-width: 400px; }
.article-body th { background: var(--table-head-bg); padding: 12px 16px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); color: var(--dark); }
.article-body td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.article-body tr:hover td { background: var(--table-hover-bg); }
.article-body img { max-width: 100%; border-radius: 8px; margin: 1rem 0; }

/* TOC — inline sous le lien actif */
.toc {
  margin: 2px 0 4px;
  padding: 6px 0 8px;
  border-top: 1px solid var(--sidebar-border);
  border-bottom: 1px solid var(--sidebar-border);
  background: rgba(0,191,255,0.04);
}
.toc-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text-light);
  padding: 0 20px;
  margin-bottom: 6px;
}
.toc a {
  display: block;
  font-size: 12px;
  color: var(--sidebar-text-light);
  text-decoration: none;
  padding: 4px 20px 4px 28px;
  border-left: 2px solid transparent;
  margin: 0 8px;
  border-radius: 0 4px 4px 0;
  transition: all 0.15s;
}
.toc a:hover { color: var(--sidebar-text); background: var(--sidebar-hover-bg); }
.toc a.active { color: var(--primary); border-left-color: var(--primary); }
.toc a.toc-h3 { padding-left: 40px; font-size: 11px; }

/* ─── THEME TOGGLE (mobile header — fond var(--bg)) ─── */
.mobile-header .theme-toggle {
  border-color: var(--border);
  color: var(--text-light);
}
.mobile-header .theme-toggle:hover { color: var(--text); border-color: var(--primary); }

/* Mobile header */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  width: 100%;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  z-index: 200;
}
.mobile-header img {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 22px;
  width: auto;
}
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; }
/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-light);
}
.empty-state h2 { font-size: 1.5rem; color: var(--dark); margin-bottom: 8px; }

@media (max-width: 768px) {
  body { flex-direction: column; }

  .mobile-header {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%;
  }

  .sidebar {
    transform: translateX(-100%);
    width: min(var(--sidebar-width), 85vw);
    top: 0; bottom: 0;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }

  .content-wrap {
    margin-left: 0;
    flex-direction: column;
    width: 100%;
    padding-top: 49px; /* hauteur du mobile-header fixe */
  }

  .content {
    padding: 20px 16px 40px;
    max-width: 100%;
  }

  .article-body { font-size: 1rem; }
  .article-body h1 { font-size: 1.5rem; }
  .article-body h2 { font-size: 1.25rem; }
  .article-body h3 { font-size: 1.05rem; }
  .article-body pre { padding: 1rem; font-size: 0.85em; border-radius: 8px; }

  .article-meta { gap: 8px; font-size: 12px; }
}
