:root{
  --bg:#0f1621; --panel:#121b27; --muted:#6c7a90;
  --text:#e9f0ff; --accent:#ff8a4c; --red:#e74c3c; --green:#2ecc71; --border:#233044;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font:14px/1.4 system-ui,Inter,Segoe UI,Roboto}

#topbar{
  position:sticky; top:0; z-index:50;
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 16px; background:#0b111a; border-bottom:1px solid #1b2535;
}
#topbar .brand{font-weight:700;color:#cfe1ff}

#app{display:flex;min-height:calc(100vh - 52px)}

/* Sidebar */
aside#sidebar{
  width:300px;background:var(--panel);border-right:1px solid var(--border);
  padding:16px;overflow:auto;text-align:center; /* centrage global */
}
aside#sidebar h3{
  margin:12px 0 8px;color:#ff7b7b;text-align:center;
}
#fav-empty{ text-align:center; }
#cat-search{
  width:90%; /* réduit pour centrer */
  margin:0 auto 8px;display:block;
  padding:10px;border:1px solid var(--border);
  background:#0c121b;color:var(--text);border-radius:8px;
}
.cat-list{
  list-style:none;margin:0;padding:0;
  display:flex;flex-direction:column;align-items:center; /* centre les items */
}
.cat-item{
  display:flex;align-items:center;justify-content:space-between;
  padding:10px 12px;
  border:1px solid #223147;background:#0f1825;
  border-radius:10px;
  margin-bottom:6px;cursor:pointer;
  width:90%;max-width:250px; /* largeur centrée */
}
.cat-item .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cat-item .star{margin-left:8px;opacity:.9}
.cat-item.selected{outline:2px solid #2c3f5c}

/* “Toutes les catégories” */
#sidebar .chip.allcats{
  width:90%; text-align:center; background:#102133; border:1px solid #244463;
  color:#cfe1ff; padding:10px 12px; border-radius:10px;
  margin:8px auto 12px; cursor:pointer; display:block;
}
#sidebar .chip.allcats:hover{ filter:brightness(1.1); }

/* Main */
#main{flex:1;display:flex;flex-direction:column;padding:16px;gap:16px}
#page-title { display:flex; align-items:center; gap:8px; }
.chip { display:inline-block; padding:8px 12px; border-radius:999px; border:1px solid var(--border); background:#0e1520; }
.chip.brand { border-color:#ff7b7b55; color:#ffb0b0; }

/* Filters */
#filters.compact{border:1px solid rgba(255,120,120,.45); background:#0e1520; border-radius:12px; padding:14px;}
.row{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:8px}
.field{display:flex;flex-direction:column;min-width:220px;flex:1}
.field.f-wide{flex:1}
label{color:#b9c6dc;margin-bottom:4px}
input,select{padding:10px;border:1px solid var(--border);border-radius:8px;background:#0c121b;color:var(--text)}
.actions{margin-left:auto;display:flex;gap:8px;align-items:end}
button{border:none;border-radius:12px;padding:10px 14px;cursor:pointer;color:white;background:#1f2a3b}
button.primary{background:var(--green)}
button.danger{background:var(--red)}
button.ghost{background:#223047}

/* Results */
#results{border:1px solid rgba(255,120,120,.45);border-radius:12px;padding:14px;background:#101723}
.empty{margin:6px 0 10px;color:#b9c6dc;opacity:.8}
.hidden{display:none!important}
.result-head{display:flex;justify-content:space-between;align-items:center;margin:10px 4px 6px}
.controls{display:flex;gap:10px;align-items:center}
.controls select,.controls input{background:#0c121b;color:#e9f0ff;border:1px solid #223147;border-radius:10px;padding:8px 10px}

/* Table */
#table{width:100%;border-collapse:separate;border-spacing:0 8px}
#table thead th{
  background:#0e1520;color:#cfe1ff;font-weight:600;
  padding:12px 14px;border-top-left-radius:10px;border-top-right-radius:10px;
  border-bottom:1px solid #223147
}
#table tbody tr{background:#0f1825;border:1px solid #203049;box-shadow:0 2px 10px rgba(0,0,0,.25)}
#table tbody td{padding:12px 14px;vertical-align:top;color:#e8f0ff;border-top:1px solid #203049}
#table tbody tr:hover{outline:2px solid #2c3f5c}
#table tbody td:nth-child(1){max-width:280px;word-break:break-all}
#table tbody td:last-child{white-space:pre-wrap;word-break:break-word;max-width:700px}
.tag{display:inline-block;padding:4px 8px;border-radius:999px;background:#132238;border:1px solid #25415f;color:#cfe1ff}
.tag.cat{background:#2a1b12;border-color:#5a3422;color:#ffb08a}
.tag.id{background:#17222f;border-color:#2a4460}
.tag.discord{background:#191f2f;border-color:#2a3e70}

/* Pager pills */
.pager{display:flex;gap:6px;align-items:center;margin:8px 0}
.pager button{background:#0e1520;color:#e8f0ff;border:1px solid #223147;padding:8px 12px;border-radius:10px;cursor:pointer}
.pager button.active{background:#ee5b5b;color:white;border-color:#ee5b5b}
.pager button:disabled{opacity:.5;cursor:not-allowed}

.cat-item .star {
  margin-left: 8px;
  opacity: .9;
  color: #cfe1ff; /* gris/bleu par défaut */
}

.cat-item .star.fav {
  color: #ffd700; /* jaune or */
}

/* === Buttons (pill, glossy, glow) === */
:root{
  --btn-radius: 999px;
  --btn-pad-y: 10px;
  --btn-pad-x: 16px;
}

.btn{
  --bg1:#162233; --bg2:#0e1724;       /* fond dégradé par défaut */
  --bd:#2a3b55; --text:#e7f0ff;        /* bord / texte */
  --glow: rgba(100,150,255,.18);       /* halo */
  position: relative;
  display: inline-flex; align-items: center; gap:10px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border-radius: var(--btn-radius);
  border: 1px solid var(--bd);
  color: var(--text); text-decoration: none;
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 0 0 0 var(--glow);
  transition: transform .05s ease, box-shadow .2s ease, filter .2s ease, opacity .2s ease;
  user-select: none; cursor: pointer;
}
.btn:hover{ filter: brightness(1.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 0 20px 2px var(--glow); }
.btn:active{ transform: translateY(1px); filter: brightness(0.98); }
.btn:disabled{ opacity:.6; cursor:not-allowed; box-shadow:none; }

/* Sizes */
.btn.sm{ --btn-pad-y:7px;  --btn-pad-x:12px; font-size:13px; }
.btn.lg{ --btn-pad-y:13px; --btn-pad-x:20px; font-size:15px; }

/* Color variants */
.btn-red{
  --bg1:#3a0f12; --bg2:#25090b;
  --bd:#5c1a1f;  --text:#ffcdcd;
  --glow: rgba(255,75,75,.22);
}
.btn-amber{
  --bg1:#3a1d08; --bg2:#241205;
  --bd:#5b2c0d;  --text:#ffd9b0;
  --glow: rgba(255,153,51,.22);
}
.btn-green{
  --bg1:#0f311f; --bg2:#081d12;
  --bd:#1e5a3a;  --text:#c9ffdf;
  --glow: rgba(60,218,118,.22);
}
.btn-ghost{ /* discret / neutre */
  --bg1:#121a27; --bg2:#0c131e; --bd:#263248; --text:#dfe8ff; --glow: rgba(140,170,255,.14);
}

/* Icon support (avec un petit pictogramme à gauche) */
.btn .icon{
  width:16px; height:16px; display:inline-block; opacity:.9; flex:0 0 16px;
  filter: drop-shadow(0 0 2px rgba(0,0,0,.4));
}

/* Modal / Détails */
.modal{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;z-index:200}
.modal.hidden{display:none}
.modal__backdrop{position:absolute;inset:0;background:rgba(0,0,0,.6)}
.modal__card{
  position:relative; width:min(900px,92vw); max-height:86vh; overflow:auto;
  background:#0f1825; border:1px solid #233044; border-radius:14px; box-shadow:0 20px 60px rgba(0,0,0,.5);
}
.modal__head{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border-bottom:1px solid #233044;background:#0c141f}
.modal__title{font-weight:700}
.modal__body{padding:14px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:8px 18px;margin-bottom:12px}
.code{background:#0b121c;border:1px solid #233044;border-radius:10px;color:#e9f0ff;padding:12px;white-space:pre-wrap;word-break:break-word}

#topbar{
  position:sticky; top:0; z-index:50;
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 16px; background:#0b111a; border-bottom:1px solid #1b2535;
}
#topbar .brand{font-weight:700;color:#cfe1ff}
#userbox{display:flex;align-items:center;gap:10px}
.btn.small{padding:6px 10px;border-radius:8px;background:#5865F2;color:#fff;text-decoration:none}
.btn.small.ghost{background:#223047}
#user-info{display:flex;align-items:center;gap:10px}
#user-info.hidden{display:none}
#user-avatar{width:26px;height:26px;border-radius:999px;border:1px solid #223147;object-fit:cover}

/* Profil utilisateur */
#user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
}

#user-info img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #223147;
}

#user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
}

#user-info img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #223147;
}

#user-info span {
  font-weight: 600;
}

#user-info .dropdown {
  position: absolute;
  top: 120%;
  right: 0;
  background: #111a27;
  border: 1px solid #223147;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  min-width: 160px;
  padding: 8px 0;
  z-index: 100;
}

#user-info .dropdown a {
  display: block;
  padding: 10px 14px;
  color: #e9f0ff;
  text-decoration: none;
}

#user-info .dropdown a:hover {
  background: #182330;
}

