/* Bot Hub : thème magenta / noir */

:root {
  --bg: #050b16;
  --panel: #0d1420;
  --panel-2: #121b2c;
  --line: #1b2a44;
  --text: #eef3fb;
  --muted: #8a97ad;
  --pink: #2f7df6;
  --pink-hi: #5fa2ff;
  --mauve: #3a4fd6;
  --green: #2fd39a;
  --amber: #f5a524;
  --red: #ef4b5b;
  --btn-grad: linear-gradient(135deg, #2f7df6 0%, #3a4fd6 52%, #060d1a 100%);
  --btn-grad-hover: linear-gradient(135deg, #4a8fff 0%, #4a63e8 52%, #0a1428 100%);
  --font: 'Familjen Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 50% -8%, #1d4f9e 0%, rgba(20, 58, 128, 0.6) 38%, transparent 72%),
    linear-gradient(180deg, #0b2148 0%, var(--bg) 55%, #02050b 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--pink-hi); }

:focus-visible { outline: 2px solid var(--pink-hi); outline-offset: 2px; }

/* ---------- boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 6px; cursor: pointer;
  font-weight: 600; font-size: 14px; color: #fff; white-space: nowrap;
  background: var(--btn-grad);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn:hover { background: var(--btn-grad-hover); transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: transparent; box-shadow: none; border: 1px solid var(--line); color: var(--text);
}
.btn-ghost:hover { background: rgba(47, 125, 246, 0.1); border-color: #2a4166; transform: none; }
.btn-danger { background: linear-gradient(135deg, #ef4b5b 0%, #8a1d3c 55%, #14070c 100%); box-shadow: 0 8px 22px rgba(239, 75, 91, 0.2); }
.btn-danger:hover { background: linear-gradient(135deg, #f7606f 0%, #a0244a 55%, #1d0a10 100%); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* ---------- champs ---------- */

label.field { display: block; }
.field-label {
  display: block; margin-bottom: 8px; font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
}
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 6px;
  background: #e9eaf8; color: #14111a; border: 2px solid transparent; font-weight: 500;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 14px; resize: vertical; }
.input:focus-visible { outline: none; border-color: var(--pink-hi); box-shadow: 0 0 0 4px rgba(47, 125, 246, 0.28); }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- connexion ---------- */

.login {
  min-height: 100vh; display: flex; justify-content: center; align-items: flex-start;
  padding: 72px 16px 48px;
}
.login-wrap { width: 100%; max-width: 450px; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.login-crown { width: 300px; max-width: 80vw; height: auto; border-radius: 12px; box-shadow: 0 10px 44px rgba(255, 150, 40, 0.35); }
.login h1 { font-size: 20px; letter-spacing: 0.34em; padding-left: 0.34em; font-weight: 700; }
.card { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.card-head { padding: 22px 26px 18px; border-bottom: 1px solid var(--line); }
.card-head b { display: block; font-size: 16px; }
.card-head span { font-size: 13px; color: var(--muted); }
.card-body { padding: 26px; display: flex; flex-direction: column; gap: 20px; }
.form-error {
  background: rgba(239, 75, 91, 0.14); border: 1px solid rgba(239, 75, 91, 0.5);
  color: #ffb3ba; border-radius: 6px; padding: 10px 14px; font-size: 13px;
}

/* ---------- coque de l'app ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 24px; background: rgba(13, 20, 32, 0.85);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; font-weight: 700; font-size: 18px; }
.brand img { height: 34px; width: auto; border-radius: 6px; }
.top-right { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }

.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 26px; letter-spacing: -0.01em; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }

.summary { display: flex; gap: 12px; flex-wrap: wrap; }
.summary-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line); font-size: 14px;
}
.summary-item b { font-size: 20px; font-variant-numeric: tabular-nums; }

/* ---------- statut ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; border: 1px solid transparent;
}
.pill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.online { color: var(--green); background: rgba(47, 211, 154, 0.1); border-color: rgba(47, 211, 154, 0.3); }
.pill.online i { box-shadow: 0 0 0 0 rgba(47, 211, 154, 0.6); animation: ping 2s infinite; }
.pill.offline { color: var(--red); background: rgba(239, 75, 91, 0.1); border-color: rgba(239, 75, 91, 0.3); }
.pill.maintenance { color: var(--pink-hi); background: rgba(47, 125, 246, 0.14); border-color: rgba(47, 125, 246, 0.45); }
.pill.maintenance i { animation: blink 1.4s infinite; }

@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(47, 211, 154, 0.6); } 70%, 100% { box-shadow: 0 0 0 7px rgba(47, 211, 154, 0); } }
@keyframes blink { 50% { opacity: 0.3; } }

/* ---------- cartes de bots ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

.bot-card {
  display: flex; flex-direction: column; gap: 16px; padding: 20px; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-width: 0;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.bot-card:hover { transform: translateY(-2px); border-color: #2a4166; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4); }
.bot-card.is-maintenance { border-color: rgba(47, 125, 246, 0.55); box-shadow: 0 0 0 1px rgba(47, 125, 246, 0.15), 0 10px 40px rgba(47, 125, 246, 0.12); }
.bot-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bot-name { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.bot-slug { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.bot-desc { color: var(--muted); font-size: 13px; min-height: 1.4em; overflow-wrap: anywhere; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 10px 12px; border-radius: 8px; background: var(--panel-2); min-width: 0; }
.stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

.maint-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px;
  border-radius: 8px; font-size: 13px; background: linear-gradient(135deg, rgba(47, 125, 246, 0.28), rgba(58, 79, 214, 0.16) 60%, rgba(6, 13, 26, 0.4));
  border: 1px solid rgba(47, 125, 246, 0.4);
}
.maint-chip b { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 15px; }
.seen { font-size: 12px; color: var(--muted); }

.empty { padding: 56px 24px; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); display: flex; flex-direction: column; gap: 16px; align-items: center; }
.empty img { width: 220px; max-width: 70%; border-radius: 10px; opacity: 0.95; box-shadow: 0 6px 28px rgba(255, 150, 40, 0.3); }

/* ---------- détail d'un bot ---------- */

.back { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0; width: fit-content; }
.back:hover { color: var(--text); }

.bot-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap;
  padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.bot-header h2 { font-size: 26px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  background: none; border: none; cursor: pointer; padding: 12px 18px; color: var(--muted);
  font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-bottom-color: var(--pink); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1 1 200px; min-width: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
}
.chip:hover { color: var(--text); border-color: #2a4166; }
.chip.active { color: #fff; border-color: rgba(47, 125, 246, 0.6); background: rgba(47, 125, 246, 0.18); }

/* logs */
.logbox {
  background: #050a14; border: 1px solid var(--line); border-radius: 8px; padding: 12px 0;
  height: 460px; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
}
.logline { display: grid; grid-template-columns: 76px 52px 1fr; gap: 10px; padding: 1px 16px; min-width: 0; }
.logline:hover { background: rgba(255, 255, 255, 0.03); }
.logline time { color: #5a6a82; }
.logline .lvl { font-weight: 700; text-transform: uppercase; font-size: 11px; padding-top: 1px; }
.logline .msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.lvl.info { color: #6fb6ff; }
.lvl.warn { color: var(--amber); }
.lvl.error { color: var(--red); }
.logbox pre { padding: 0 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; }
.log-empty { padding: 40px 16px; text-align: center; color: var(--muted); font-family: var(--font); }

/* liens */
.links { display: flex; flex-direction: column; gap: 10px; }
.link-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 16px;
  background: var(--panel-2); border-radius: 8px; min-width: 0;
}
.link-row a { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.link-row small { display: block; color: var(--muted); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }

/* maintenance */
.presets { display: flex; gap: 8px; flex-wrap: wrap; }

/* intégration */
.code {
  position: relative; background: #050a14; border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; overflow-x: auto; white-space: pre;
}
.copy { position: absolute; top: 10px; right: 10px; }
.key-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.key {
  flex: 1 1 260px; min-width: 0; padding: 10px 14px; border-radius: 6px; background: #050a14; border: 1px solid var(--line);
  font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere;
}
.panel h3 { font-size: 16px; }
.panel p { color: var(--muted); font-size: 14px; }
.divider { height: 1px; background: var(--line); }

/* modale */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(2, 5, 11, 0.7); backdrop-filter: blur(4px); }
.modal-box { width: 100%; max-width: 480px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.modal-box .card-body { gap: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60; padding: 12px 20px;
  border-radius: 8px; background: var(--panel-2); border: 1px solid rgba(47, 125, 246, 0.5); font-size: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.toast.error { border-color: rgba(239, 75, 91, 0.6); color: #ffb3ba; }

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .page { padding: 24px 16px 48px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .logline { grid-template-columns: 1fr; gap: 0; padding-block: 4px; }
  .bot-header { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- coffre Discord ---- */
.tag { display: inline-block; font: 600 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.ok { color: var(--green); border-color: rgba(47, 211, 154, 0.3); background: rgba(47, 211, 154, 0.08); }
.dc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dc-add { display: grid; grid-template-columns: 140px 1fr 1.1fr 1fr auto; gap: 12px; align-items: end; }
.dc-list { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dc-row { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dc-row:last-child { border-bottom: 0; }
.dc-row:hover { background: rgba(255, 255, 255, 0.02); }
.dc-main { flex: 1 1 180px; min-width: 0; }
.dc-main b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.dc-main small { color: var(--muted); font-size: 12.5px; }
.dc-row code { font: 500 12.5px var(--mono); color: var(--pink-hi); }
.dc-check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.dc-check input { accent-color: var(--pink); width: 16px; height: 16px; }
.dc-msgs { border: 1px solid var(--line); border-radius: 8px; max-height: 320px; overflow-y: auto; }
.dc-msg { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.dc-msg:last-child { border-bottom: 0; }
.dc-msg b { font-size: 13.5px; }
.dc-msg span { font: 500 11px var(--mono); color: var(--muted); margin-left: 8px; }
.dc-msg p { color: var(--text); font-size: 14px; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dc-msg i { color: var(--muted); }
@media (max-width: 800px) { .dc-grid, .dc-add { grid-template-columns: 1fr; } }

/* Discussion */
.chat { display: grid; grid-template-columns: 280px 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel, #0b1220); min-height: 520px; }
.chat-side { border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chat-open { display: flex; gap: 8px; }
.chat-open .input { min-width: 0; }
.chat-list { overflow-y: auto; max-height: 460px; display: flex; flex-direction: column; gap: 2px; }
.chat-ch { text-align: left; background: none; border: 1px solid transparent; border-radius: 6px; color: var(--muted); padding: 8px 10px; cursor: pointer; font: inherit; }
.chat-ch b { display: block; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.chat-ch small { font-size: 12px; opacity: .8; }
.chat-ch:hover { color: var(--text); }
.chat-ch.on { color: #fff; background: rgba(47, 125, 246, 0.14); border-color: rgba(47, 125, 246, 0.45); }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.chat-msgs { flex: 1; overflow-y: auto; height: 380px; padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { color: var(--muted); font-size: 14px; }
.chat-msg { max-width: 82%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.02); align-self: flex-start; }
.chat-msg.self { align-self: flex-end; background: rgba(47, 125, 246, 0.14); border-color: rgba(47, 125, 246, 0.4); }
.chat-meta b { font-size: 13.5px; }
.chat-meta span { font: 500 11px var(--mono); color: var(--muted); margin-left: 8px; }
.chat-msg p { font-size: 14px; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.chat-embed { margin-top: 6px; padding: 8px 12px; border-left: 3px solid var(--pink); background: rgba(255, 255, 255, 0.03); border-radius: 4px; }
.chat-embed b { font-size: 13.5px; }
.chat-file { margin-top: 6px; font-size: 13px; color: var(--pink-hi); }
.chat-in { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-in .input { flex: 1; resize: none; }
@media (max-width: 800px) { .chat { grid-template-columns: 1fr; } .chat-side { border-right: 0; border-bottom: 1px solid var(--line); } .chat-list { max-height: 160px; } }

.top-nav { display: flex; gap: 6px; margin-left: 28px; flex: 1; }
.top-nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: 14px; font-weight: 600; }
.top-nav a:hover { color: var(--text); }
.top-nav a.on { color: #fff; background: rgba(47, 125, 246, 0.16); }
a.tab { text-decoration: none; display: inline-flex; align-items: center; }
