/* BL Forge — même design que le panel Brothers Life (dégradé du logo, Geist). */

/* ================================ Tokens ================================ */
:root {
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --side-w: 260px;
  --top-h: 60px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --brand-1: #ff7a18;
  --brand-2: #ffb547;
  --brand-grad: linear-gradient(135deg, #ff5f1f 0%, #ff8a1f 45%, #ffc04d 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f43f5e;
  --info: #60a5fa;
}
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a090c;
  --bg-2: #0f0d12;
  --surface: rgba(24, 21, 28, .66);
  --surface-solid: #16131a;
  --surface-2: rgba(255, 255, 255, .035);
  --surface-hover: rgba(255, 255, 255, .06);
  --input: rgba(0, 0, 0, .28);
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .13);
  --ink: #f4f1ee;
  --ink-2: #b9b2ad;
  --ink-3: #7c7570;
  --glow: rgba(255, 122, 24, .22);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 40px -24px rgba(0, 0, 0, .8);
  --orb-1: rgba(255, 106, 0, .16);
  --orb-2: rgba(139, 92, 246, .12);
  --code-bg: rgba(0, 0, 0, .35);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f4f1;
  --bg-2: #efece8;
  --surface: rgba(255, 255, 255, .82);
  --surface-solid: #ffffff;
  --surface-2: rgba(20, 14, 8, .03);
  --surface-hover: rgba(20, 14, 8, .05);
  --input: #fff;
  --line: rgba(20, 14, 8, .08);
  --line-strong: rgba(20, 14, 8, .15);
  --ink: #17120e;
  --ink-2: #57504a;
  --ink-3: #8f8780;
  --glow: rgba(255, 122, 24, .18);
  --shadow: 0 1px 2px rgba(20, 14, 8, .04), 0 12px 32px -18px rgba(20, 14, 8, .18);
  --orb-1: rgba(255, 138, 31, .14);
  --orb-2: rgba(139, 123, 255, .09);
  --code-bg: #f3efea;
}

/* ================================ Base ================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-1); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
code, pre, kbd { font-family: var(--mono); }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(600px 400px at 85% -5%, var(--orb-1), transparent 70%), radial-gradient(500px 400px at 10% 110%, var(--orb-2), transparent 70%); }
::selection { background: var(--glow); }
svg { flex-shrink: 0; }

/* =============================== Layout ================================ */
#side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); display: flex; flex-direction: column; background: var(--bg-2); border-right: 1px solid var(--line); z-index: 30; }
#top { position: sticky; top: 0; margin-left: var(--side-w); height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); z-index: 20; }
#main { margin-left: var(--side-w); padding: 28px 32px 80px; max-width: 1500px; }
#menu-btn, #scrim { display: none; }

.brand { display: flex; align-items: center; gap: 12px; padding: 16px 18px; color: var(--ink); border-bottom: 1px solid var(--line); }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 10px; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand b { font-size: 16px; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { color: var(--ink-3); font-size: 12px; }

#nav { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; }
#nav a:hover { background: var(--surface-hover); color: var(--ink); text-decoration: none; }
#nav a.on { background: var(--surface-hover); color: var(--ink); box-shadow: inset 2px 0 0 var(--brand-1); }
#nav a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#nav em { font-style: normal; font-size: 11px; color: var(--ink-3); background: var(--surface-2); padding: 0 7px; border-radius: 99px; }
.nav-group { margin-top: 10px; }
#nav .nav-cat { color: var(--ink); font-weight: 600; }
#nav .nav-tool { padding: 5px 10px 5px 38px; font-weight: 400; font-size: 13px; }
.side-foot { padding: 12px 18px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12px; }

/* ================================ Recherche ================================ */
.search-box { position: relative; width: min(440px, 100%); }
.search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); display: flex; }
#search { width: 100%; padding: 9px 12px 9px 36px; border-radius: var(--r); }
#search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .5); padding: 6px; max-height: 70vh; overflow: auto; }
#search-results a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink); }
#search-results a span { display: flex; flex-direction: column; line-height: 1.25; }
#search-results small { color: var(--ink-3); }
#search-results a:hover, #search-results a.on { background: var(--surface-hover); text-decoration: none; }

/* ================================ Boutons ================================ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 12px; gap: 5px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-hover); }
.btn.icon { padding: 8px; }
.btn.primary { background: var(--brand-grad); color: #1b0f05; border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.discord { background: #5865f2; color: #fff; border-color: transparent; }
.btn.discord:hover { background: #4752c4; }

#user-box { display: flex; align-items: center; gap: 4px; }
.user { display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border-radius: 99px; color: var(--ink); }
.user:hover { background: var(--surface-hover); text-decoration: none; }
.user img { width: 30px; height: 30px; border-radius: 50%; }
.user span { display: flex; flex-direction: column; line-height: 1.15; }
.user small { color: var(--ink-3); font-size: 11px; }

/* ================================ Accueil ================================ */
.hero { display: flex; gap: 24px; align-items: center; padding: 28px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 32px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: auto -10% -60% 40%; height: 200px; background: radial-gradient(closest-side, var(--glow), transparent); pointer-events: none; }
.hero-logo { width: 92px; height: 92px; border-radius: 22px; box-shadow: 0 10px 40px -10px var(--glow); }
.hero h1 { font-size: 34px; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; }
.hero p { color: var(--ink-2); max-width: 720px; margin-top: 6px; font-size: 15px; }
.hero-stats { display: flex; gap: 20px; margin-top: 14px; flex-wrap: wrap; color: var(--ink-3); }
.hero-stats b { color: var(--ink); font-size: 16px; }
.cat-section { margin-bottom: 30px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2, .page-head h1 { display: flex; align-items: center; gap: 9px; }
.section-head h2 svg, .page-head h1 svg { color: var(--brand-1); }
.page-head { margin-bottom: 20px; display: flex; flex-direction: column; gap: 4px; }
.tool-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tool-card { display: flex; gap: 12px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink); transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; }
.tool-card:hover { border-color: color-mix(in srgb, var(--brand-1) 45%, var(--line)); transform: translateY(-2px); text-decoration: none; box-shadow: 0 12px 30px -18px var(--glow); }
.tool-card p { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.tool-ico { width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; color: var(--brand-1); background: color-mix(in srgb, var(--brand-1) 12%, transparent); }

/* ============================== Page d'outil ============================== */
.tool-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.tool-title { display: flex; gap: 14px; align-items: center; flex: 1; min-width: 260px; }
.tool-title .tool-ico { width: 46px; height: 46px; border-radius: 12px; }
.project-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 5px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.project-name { font-size: 12px; padding: 0 8px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Briques de mise en page pour les outils */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.split > .sticky { position: sticky; top: calc(var(--top-h) + 16px); }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; margin: -2px 0 12px; flex-wrap: wrap; }
.panel-head h3 { flex: 1; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.note { padding: 10px 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--info) 10%, transparent); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent); color: var(--ink-2); font-size: 13px; }
.note.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.note.error { background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.chip.on { background: color-mix(in srgb, var(--brand-1) 16%, transparent); border-color: color-mix(in srgb, var(--brand-1) 40%, transparent); color: var(--ink); }
button.chip { cursor: pointer; font-family: var(--font); }
.chip button { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 0 0 0 2px; font-size: 13px; line-height: 1; }
.chip button:hover { color: var(--danger); }
.row > .tabs { min-width: 0; }
kbd { font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-strong); background: var(--surface-2); }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--r); padding: 22px; text-align: center; color: var(--ink-2); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.drag { border-color: var(--brand-1); background: color-mix(in srgb, var(--brand-1) 6%, transparent); }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--line-strong); vertical-align: middle; }

/* ================================ Champs ================================ */
input[type=text], input[type=search], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--input); color: var(--ink); font: 13px var(--font); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-1); box-shadow: 0 0 0 3px var(--glow); }
input[type=checkbox] { accent-color: var(--brand-1); width: 16px; height: 16px; margin: 0; }
input[type=range] { accent-color: var(--brand-1); width: 100%; }
input[type=color] { width: 100%; height: 36px; padding: 2px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--input); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field.check label { font-size: 13px; color: var(--ink); }
.field output { font: 12px var(--mono); color: var(--ink-3); }
.hint { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--surface-hover); color: var(--ink-3); font-size: 10px; cursor: help; }

/* ================================ Sortie de code ================================ */
.output { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; min-width: 0; }
.output-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; border-bottom: 1px solid var(--line); }
.output-title { font: 500 12px var(--mono); color: var(--ink-2); }
pre.code { margin: 0; padding: 14px; background: var(--code-bg); overflow: auto; max-height: 560px; font-size: 12.5px; line-height: 1.55; tab-size: 4; white-space: pre; }

/* ================================ Onglets ================================ */
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); overflow-x: auto; width: fit-content; max-width: 100%; }
.tabs button { padding: 6px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: var(--surface-solid); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }

/* ================================ Tableaux ================================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 500; color: var(--ink-3); background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td input, .table td select { padding: 5px 7px; }
.table .actions { text-align: right; white-space: nowrap; }

/* ================================ Divers ================================ */
.empty { padding: 24px; text-align: center; color: var(--ink-3); }
.empty.big { padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { padding: 10px 14px; border-radius: var(--r-sm); background: var(--surface-solid); border: 1px solid var(--line-strong); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); border-left: 3px solid var(--ok); animation: in .2s var(--ease); max-width: 380px; }
.toast.error { border-left-color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }
.modal { border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface-solid); color: var(--ink); padding: 0; width: min(520px, 92vw); max-height: 80vh; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); }
.modal::backdrop { background: rgba(0, 0, 0, .5); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 8px; overflow: auto; max-height: 60vh; }
.list-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); font: 14px var(--font); text-align: left; cursor: pointer; }
.list-item:hover { background: var(--surface-hover); }
.list-item small { color: var(--ink-3); }

/* ================================ Mobile ================================ */
@media (max-width: 1100px) {
  .split, .split.wide-left { grid-template-columns: minmax(0, 1fr); }
  .split > .sticky { position: static; }
}
@media (max-width: 860px) {
  #side { transform: translateX(-100%); transition: transform .25s var(--ease); }
  body.nav-open #side { transform: none; }
  #scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 25; }
  body.nav-open #scrim { opacity: 1; pointer-events: auto; }
  #menu-btn { display: inline-flex; }
  #top, #main { margin-left: 0; }
  #top { padding: 0 12px; gap: 6px; }
  #main { padding: 18px 16px 60px; }
  .user span { display: none; }
  .btn.discord { padding: 8px; font-size: 0; gap: 0; }
  .hero { flex-direction: column; align-items: flex-start; padding: 20px; }
  .hero h1 { font-size: 28px; }
}
