/* ==================================================================
   Tech237 — Styles de l'administration
   ================================================================== */

/* ---------- Login ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0d1526, #1a1440 60%, #0c2438); padding: 24px; }
.login-wrap { width: 100%; max-width: 430px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  padding: 38px; box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand h1 { font-size: 1.4rem; margin-top: 12px; letter-spacing: -.02em; }
.login-brand p { color: var(--muted); font-size: .88rem; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-hint {
  margin-top: 20px; padding: 12px 14px; border-radius: 10px; font-size: .8rem;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px dashed color-mix(in srgb, var(--primary) 45%, transparent);
  color: var(--text-soft); text-align: center;
}
.login-hint code { color: var(--primary); font-weight: 700; }
.login-back { display: block; text-align: center; margin-top: 16px; font-size: .88rem; color: var(--muted); }
.login-back:hover { color: var(--primary); }

/* ---------- Structure ---------- */
.admin-body { background: var(--bg); }
.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-sidebar {
  background: #0c1322; color: #94a3b8; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; border-bottom: 1px solid #1b2740; }
.admin-brand span { display: flex; flex-direction: column; line-height: 1.2; }
.admin-brand strong { color: #fff; font-size: 1.05rem; }
.admin-brand small { font-size: .7rem; color: #64748b; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; flex: 1; overflow-y: auto; }
.admin-nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #94a3b8; font-size: .9rem; font-weight: 600; transition: all .15s;
}
.admin-nav a:hover { background: #17203a; color: #e2e8f0; }
.admin-nav a.active { background: linear-gradient(90deg, rgba(99, 102, 241, .22), rgba(99, 102, 241, .06)); color: #a5b4fc; }
.admin-nav a span { font-size: 1.05rem; }
.badge-count {
  margin-left: auto; font-style: normal; font-size: .7rem; font-weight: 700;
  background: #6366f1; color: #fff; border-radius: 999px; padding: 1px 8px;
}
.badge-count.warn { background: #f59e0b; color: #111; }
.admin-new-link { border: 1px dashed #2c3b5e; margin-top: 2px; }
.admin-sidebar-foot { padding: 14px 20px; border-top: 1px solid #1b2740; display: flex; flex-direction: column; gap: 6px; }
.admin-sidebar-foot a { color: #64748b; font-size: .82rem; font-weight: 600; }
.admin-sidebar-foot a:hover { color: #22d3ee; }

.admin-main { min-width: 0; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 28px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 50;
}
.admin-topbar h1 { font-size: 1.35rem; letter-spacing: -.02em; }
.admin-topbar p { color: var(--muted); font-size: .84rem; }
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-user strong { font-size: .9rem; display: block; line-height: 1.2; }
.admin-user small { color: var(--muted); font-size: .74rem; }
.admin-content { padding: 26px 28px 60px; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Statistiques ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 18px; display: flex; align-items: center; gap: 13px; position: relative;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-card strong { font-size: 1.35rem; display: block; line-height: 1.1; letter-spacing: -.02em; }
.stat-card small { color: var(--muted); font-size: .76rem; }
.stat-card a { position: absolute; right: 14px; bottom: 10px; font-size: .72rem; font-weight: 700; opacity: 0; transition: opacity .2s; }
.stat-card:hover a { opacity: 1; }

/* ---------- Panneaux ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { font-size: 1.05rem; }
.panel-hint { font-size: .74rem; color: var(--muted); }
.panel-link { font-size: .82rem; font-weight: 700; }
.panel-title { font-size: 1.02rem; margin-bottom: 14px; }
.panel-tip { margin-top: 14px; font-size: .8rem; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 10px 14px; }
.panel-tip code { color: var(--primary); }
.admin-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.admin-grid.even { grid-template-columns: 1fr 1fr; }

/* ---------- Graphiques ---------- */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); }
.chart .axis { stroke: var(--border); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 4 4; opacity: .55; }
.chart .bar { rx: 5px; transition: opacity .2s; }
.chart .bar:hover { opacity: .75; }
.chart .label { fill: var(--muted); font-size: 11px; }
.chart .value-label { fill: var(--text-soft); font-size: 10px; font-weight: 600; }
.chart-title { fill: var(--text); font-size: 13px; font-weight: 700; }

/* ---------- Tableaux ---------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-size: .74rem;
  text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border);
}
.admin-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cell-title a { color: var(--text); font-weight: 600; }
.cell-title a:hover { color: var(--primary); }
.cell-sub { display: block; color: var(--muted); font-size: .74rem; }
.cell-date { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.cell-comment { color: var(--text-soft); max-width: 340px; }
.cell-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.empty-cell { text-align: center; color: var(--muted); padding: 30px !important; }
.row-unread { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.row-unread td:first-child strong { color: var(--primary); }
.status-badge {
  display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 11px; border-radius: 999px;
}
.status-badge.publie, .status-badge.approuve { background: rgba(16, 185, 129, .12); color: #059669; }
.status-badge.brouillon, .status-badge.en_attente { background: rgba(245, 158, 11, .14); color: #b45309; }
.status-badge.rejete { background: rgba(239, 68, 68, .12); color: #dc2626; }
.mini-badge { font-size: .66rem; font-weight: 700; background: #f59e0b; color: #111; border-radius: 6px; padding: 2px 7px; margin-left: 8px; }
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; }
.action-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; display: inline-grid; place-items: center;
  font-size: .9rem; transition: all .15s;
}
.action-btn:hover { border-color: var(--primary); transform: translateY(-1px); }
.action-btn.danger:hover { border-color: var(--red); background: rgba(239, 68, 68, .08); }
.action-btn.ok:hover { border-color: var(--green); background: rgba(16, 185, 129, .08); }
.action-btn.warn:hover { border-color: var(--amber); background: rgba(245, 158, 11, .08); }

/* ---------- Barre d'outils ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.toolbar-form { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-form input, .toolbar-form select { width: auto; }
.filter-tabs { display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 12px; }
.filter-tabs a { padding: 7px 14px; border-radius: 9px; font-size: .84rem; font-weight: 600; color: var(--text-soft); }
.filter-tabs a:hover { color: var(--primary); }
.filter-tabs a.active { background: var(--primary); color: #fff; }

/* ---------- Éditeur d'article ---------- */
.editor-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.editor-main { display: flex; flex-direction: column; gap: 2px; }
.editor-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.editor-tab {
  padding: 7px 16px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2);
  font-weight: 600; font-size: .84rem; cursor: pointer; color: var(--text-soft);
}
.editor-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.editor-textarea { font-family: var(--mono); font-size: .86rem; line-height: 1.7; }
.markdown-preview { border: 1px solid var(--border); border-radius: 11px; padding: 18px 20px; min-height: 300px; }
.markdown-preview h2 { font-size: 1.25rem; margin: 1em 0 .5em; }
.markdown-preview h3 { font-size: 1.05rem; margin: 1em 0 .5em; }
.markdown-preview p { margin-bottom: .9em; }
.markdown-preview pre { background: #0d1526; color: #dbe4f5; border-radius: 10px; padding: 14px; overflow-x: auto; font-size: .82rem; }
.markdown-preview code { background: rgba(99, 102, 241, .1); color: var(--primary); padding: 2px 6px; border-radius: 5px; font-size: .85em; }
.markdown-preview pre code { background: none; color: inherit; padding: 0; }
.markdown-preview blockquote { border-left: 3px solid var(--primary); padding-left: 14px; color: var(--text-soft); font-style: italic; margin: 1em 0; }
.md-help { font-size: .78rem; color: var(--muted); margin-top: 8px; }
.cover-current { display: flex; align-items: center; gap: 12px; margin-top: 10px; font-size: .82rem; color: var(--muted); }
.cover-current img { width: 130px; height: 74px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.info-list { list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: .84rem; }
.info-list span { color: var(--muted); display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.info-list code { font-size: .78rem; word-break: break-all; }
.stack-form { display: flex; flex-direction: column; gap: 4px; }
.checkbox { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: .9rem; margin: 10px 0; cursor: pointer; }
.checkbox input { width: auto; }
.inline-details { position: relative; }
.inline-details summary { list-style: none; cursor: pointer; }
.inline-form {
  position: absolute; right: 0; top: 38px; z-index: 60; width: 280px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.qa-btn {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: .88rem; cursor: pointer; width: 100%; text-align: left;
  transition: all .15s;
}
.qa-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateX(3px); }
.qa-btn.danger:hover { border-color: var(--red); color: var(--red); }
.settings-form { display: flex; flex-direction: column; gap: 20px; max-width: 860px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .admin-nav a { font-size: .82rem; padding: 8px 10px; }
  .admin-sidebar-foot { flex-direction: row; justify-content: space-around; }
  .admin-grid, .editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .admin-content { padding: 18px 14px 40px; }
  .admin-topbar { padding: 14px; flex-wrap: wrap; }
  .admin-table { font-size: .8rem; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
}
