/* Espace membre Colabs DZ : administration, profil, connexion */
:root {
  --bg: #f4f6f8; --card: #fff; --ink: #14202b; --muted: #64748b; --line: #e3e8ee;
  --primary: #0b7f76; --primary-dark: #086860; --primary-soft: #e3f4f2;
  --gold: #b7791f; --danger: #c2410c; --danger-soft: #fdece4; --success: #15803d; --success-soft: #e6f5ec;
  --warn-soft: #fff5dd; --info-soft: #e6f0fb; --radius: 12px; --sidebar: 250px;
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; --font-h: 'Sora', var(--font);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 15px; }
h1, h2, h3 { font-family: var(--font-h); line-height: 1.25; margin: 0 0 .5em; }
h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
code { background: #eef2f6; padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .right { text-align: right; }
.lead { font-size: 1.05rem; margin: 0 0 1.2rem; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: #0f1d2b; color: #cbd5e1; padding: 18px 14px; display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-h); font-weight: 700; color: #fff; padding: 4px 8px 18px; font-size: 1.05rem; }
.brand:hover { text-decoration: none; } .brand img { border-radius: 6px; }
.brand-center { justify-content: center; color: var(--ink); padding-bottom: 6px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a { color: #cbd5e1; padding: 9px 12px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.side-nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.side-nav a.active { background: var(--primary); color: #fff; }
.side-title { text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; color: #7b8ba0; margin: 18px 12px 4px; }
.count { background: var(--gold); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 8px; font-weight: 700; }
.side-logout { margin-top: 16px; }
.main { margin-left: var(--sidebar); flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; }
.page-title { font-size: 1.25rem; margin: 0; flex: 1; }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 1.2rem; padding: 4px 10px; cursor: pointer; }
.who { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.who:hover { text-decoration: none; }
.who span { display: flex; flex-direction: column; line-height: 1.2; } .who small { color: var(--muted); font-size: .75rem; }
.content { padding: 26px 28px 60px; max-width: 1240px; }

/* Cartes / grilles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card h2 { margin-bottom: .8rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .6rem; } .card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; } .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; }
.stat-n { font-family: var(--font-h); font-size: 1.9rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat-l { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.mini-stats div { background: var(--bg); border-radius: 10px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.mini-stats strong { font-family: var(--font-h); font-size: 1.3rem; } .mini-stats span { font-size: .75rem; color: var(--muted); }
.profile-head { display: flex; gap: 16px; align-items: center; } .profile-head h2 { margin: 0 0 2px; font-size: 1.25rem; } .profile-head p { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; } .list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.list li:last-child { border: 0; } .list small { flex-basis: 100%; }
.empty { color: var(--muted); padding: 14px 4px; margin: 0; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 9px; padding: 9px 16px;
  font: 600 .9rem var(--font); cursor: pointer; background: var(--primary); color: #fff; transition: .15s; text-decoration: none; }
.btn:hover { text-decoration: none; background: var(--primary-dark); }
.btn-primary { background: var(--primary); }
.btn-success { background: var(--success); } .btn-success:hover { background: #106a33; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); } .btn-ghost:hover { background: var(--bg); }
.sidebar .btn-ghost { background: transparent; color: #cbd5e1; border-color: rgba(255,255,255,.2); } .sidebar .btn-ghost:hover { background: rgba(255,255,255,.08); }
.btn-danger { background: var(--danger); } .btn-danger:hover { background: #9a3412; }
.btn-danger-ghost { background: #fff; color: var(--danger); border-color: #f3cdbd; } .btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: .8rem; border-radius: 7px; } .btn-block { width: 100%; }
.btn-stack { display: flex; flex-direction: column; gap: 8px; }

/* Formulaires */
.field { margin-bottom: 16px; } .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
label small { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], select, textarea, input:not([type]) {
  width: 100%; padding: 10px 12px; border: 1px solid #cfd8e1; border-radius: 9px; font: inherit; background: #fff; color: var(--ink); }
input[type=file] { font-size: .85rem; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.input-lg { font-size: 1.15rem; font-family: var(--font-h); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 8px 0; cursor: pointer; } .check input { width: auto; }
.form-narrow { max-width: 720px; } .form-actions { display: flex; gap: 10px; margin-top: 8px; }
.input-group { display: flex; gap: 8px; } .input-group input { flex: 1; }
.field small { display: block; margin-top: 4px; }

/* Alertes */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid transparent; font-size: .92rem; }
.alert-success { background: var(--success-soft); border-color: #bfe3cc; color: #14532d; }
.alert-error { background: var(--danger-soft); border-color: #f3cdbd; color: #7c2d12; }
.alert-warning { background: var(--warn-soft); border-color: #f2dda1; color: #6b4a0b; }
.alert-info { background: var(--info-soft); border-color: #c7dcf3; color: #1e3a5f; }

/* Tableaux */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .t-title { min-width: 240px; } .table .t-title a { font-weight: 600; color: var(--ink); }
.note { display: block; color: var(--danger); margin-top: 3px; }
.actions { white-space: nowrap; } .actions .inline { display: inline-block; } .actions > * { vertical-align: middle; margin: 1px 2px; }
.cell-user { display: flex; align-items: center; gap: 10px; } .cell-user small { display: block; }
details.reject { display: inline-block; position: relative; } details.reject summary { list-style: none; cursor: pointer; }
details.reject summary::-webkit-details-marker { display: none; }
details.reject form { position: absolute; right: 0; top: 110%; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; width: 280px;
  box-shadow: 0 8px 24px rgba(15,29,43,.15); z-index: 10; display: flex; flex-direction: column; gap: 8px; text-align: left; }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.badge-draft { background: #eceff3; color: #475569; } .badge-pending { background: var(--warn-soft); color: #92600c; }
.badge-published { background: var(--success-soft); color: var(--success); } .badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-role-admin { background: #ede7fb; color: #5b3aa8; } .badge-role-researcher { background: var(--primary-soft); color: var(--primary-dark); }

/* Barre d'outils / filtres / pagination */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; } .filters input, .filters select { width: auto; min-width: 150px; }
.pager { display: flex; gap: 6px; margin: 16px 0 6px; flex-wrap: wrap; }
.pager .pg { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.pager .pg.active { background: var(--primary); color: #fff; border-color: var(--primary); } .pager .pg:hover { text-decoration: none; background: var(--bg); }

/* Avatars */
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-block; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; font-family: var(--font-h); }

/* Éditeur d'article */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.side-panel .card { margin-bottom: 16px; } .side-panel { position: sticky; top: 84px; }
.article-status { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.cover-preview { width: 100%; border-radius: 9px; margin-bottom: 8px; aspect-ratio: 16/9; object-fit: cover; }
#editor { min-height: 380px; background: #fff; font-size: 1.02rem; }
.ql-toolbar.ql-snow { border-radius: 9px 9px 0 0; border-color: #cfd8e1; } .ql-container.ql-snow { border-radius: 0 0 9px 9px; border-color: #cfd8e1; }
.ql-editor { min-height: 380px; line-height: 1.7; } .ql-editor img { max-width: 100%; height: auto; }

/* Pages centrées */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px; width: 100%; max-width: 420px; box-shadow: 0 10px 40px rgba(15,29,43,.08); }
.auth-card h1 { text-align: center; font-size: 1.4rem; margin-top: 8px; } .auth-code { font-family: var(--font-h); font-size: 3rem; margin: 0; color: var(--primary); font-weight: 700; }

/* Toasts (retours des appels fetch) */
.toast-box { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.toast { background: #14202b; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: .88rem; box-shadow: 0 8px 24px rgba(15,29,43,.25);
  opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); } .toast-error { background: var(--danger); } .toast-warning { background: #92600c; }

/* Boutons en cours de traitement (appel fetch en vol) */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 15px; height: 15px; top: 50%; left: 50%; margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: btn-spin .6s linear infinite; }
.btn-ghost.is-loading::after, .btn-danger-ghost.is-loading::after { border-color: rgba(11,127,118,.3); border-top-color: var(--primary); }
@keyframes btn-spin { to { transform: rotate(360deg); } }
tr.is-removing { opacity: 0; transform: translateX(8px); transition: opacity .25s, transform .25s; }

/* Erreurs de formulaire affichées par JS */
.field-error { color: var(--danger); font-size: .82rem; margin-top: 4px; }

/* Responsive */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; } body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .main { margin-left: 0; } .menu-toggle { display: block; } .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .grid-2, .editor-layout, .field-row { grid-template-columns: 1fr; } .side-panel { position: static; } .who span { display: none; }
}
