/* Panneau d'administration — thème sombre proche de Discord, pour que
   l'aperçu ressemble à ce qui sera réellement publié. */

:root {
  --bg: #1e1f22;
  --panel: #2b2d31;
  --panel-2: #313338;
  --field: #1e1f22;
  --line: #3f4147;
  --text: #dbdee1;
  --text-dim: #949ba4;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --green: #23a55a;
  --red: #f23f43;
  --amber: #f0b232;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ── Barre du haut ─────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-dim);
}
.dot.ok { background: var(--green); }
.dot.ko { background: var(--red); }

.muted { color: var(--text-dim); font-size: 13px; }

/* ── Disposition ───────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 16px;
  align-items: start;
  max-width: 1500px;
  margin: 0 auto;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

h2 { font-size: 15px; margin: 0; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); }

.empty-panel { color: var(--text-dim); text-align: center; padding: 60px 20px; }

/* ── Liste des messages ────────────────────────────────────────────────── */

.message-list { display: flex; flex-direction: column; gap: 6px; }

.msg-card {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--panel-2);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.msg-card:hover { background: #3a3c42; }
.msg-card.active { border-left-color: var(--accent); background: #3a3c42; }
.msg-card.paused .msg-name { color: var(--text-dim); }

.msg-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.msg-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.badge {
  font-size: 10px; padding: 1px 6px; border-radius: 10px;
  background: var(--line); color: var(--text-dim); text-transform: uppercase;
}
.badge.on { background: rgba(35,165,90,.2); color: var(--green); }

/* ── Éditeur ───────────────────────────────────────────────────────────── */

.editor-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }

.title-input {
  flex: 1; background: transparent; border: none; border-bottom: 2px solid var(--line);
  color: var(--text); font-size: 20px; font-weight: 600; padding: 6px 2px;
}
.title-input:focus { outline: none; border-bottom-color: var(--accent); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }

.tab {
  background: none; border: none; color: var(--text-dim);
  padding: 8px 14px; cursor: pointer; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-bottom-color: var(--accent); }

.tab-body { display: none; }
.tab-body.active { display: block; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

/* ── Champs ────────────────────────────────────────────────────────────── */

.field { margin-bottom: 18px; }
.field-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }

label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
        color: var(--text-dim); font-weight: 600; margin-bottom: 6px; }

.hint { font-size: 12px; color: var(--text-dim); margin: 6px 0 0; text-transform: none; letter-spacing: 0; font-weight: 400; }

input[type=text], input[type=time], select, textarea {
  width: 100%; background: var(--field); border: 1px solid var(--line);
  border-radius: 4px; color: var(--text); padding: 9px 10px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

textarea { resize: vertical; min-height: 130px; line-height: 1.5; }

input[type=range] { width: 100%; accent-color: var(--accent); }

.check, .switch { display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
                  text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); font-weight: 400; }
.check em { color: var(--text-dim); font-style: normal; font-size: 13px; }
.check input, .switch input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* ── Variantes ─────────────────────────────────────────────────────────── */

.variant {
  background: var(--panel-2); border-radius: 6px; padding: 12px; margin-bottom: 10px;
}
.variant-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.variant-title { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.variant-tools { display: flex; gap: 6px; align-items: center; }

.counter { font-size: 12px; color: var(--text-dim); }
.counter.over { color: var(--red); font-weight: 600; }

/* ── Planification ─────────────────────────────────────────────────────── */

.schedule {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--panel-2); border-radius: 6px; padding: 12px; margin-bottom: 10px;
}
.days { display: flex; gap: 4px; }
.day {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--field); color: var(--text-dim); cursor: pointer; font-size: 13px;
}
.day.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.schedule input[type=time] { width: 110px; }
.schedule .next { font-size: 12px; color: var(--text-dim); flex: 1; }

/* ── Aperçu Discord ────────────────────────────────────────────────────── */

.discord-preview { background: var(--panel-2); border-radius: 6px; padding: 14px; min-height: 140px; }
.dp-row { display: flex; gap: 12px; }
.dp-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.dp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.dp-name { font-weight: 600; color: #fff; }
.dp-tag { background: var(--accent); color: #fff; font-size: 10px; padding: 1px 4px; border-radius: 3px; font-weight: 600; }
.dp-time { font-size: 11px; color: var(--text-dim); }
.dp-content { white-space: pre-wrap; word-break: break-word; }
.dp-content code { background: var(--bg); padding: 1px 4px; border-radius: 3px; font-family: Consolas, monospace; font-size: 13px; }
.dp-content pre { background: var(--bg); padding: 8px; border-radius: 4px; overflow-x: auto; border: 1px solid var(--line); }
.dp-content .mention { background: rgba(88,101,242,.3); color: #c9cdfb; padding: 0 2px; border-radius: 3px; }
.dp-content .spoiler { background: var(--line); border-radius: 3px; }
.dp-content .emoji { width: 22px; height: 22px; vertical-align: -4px; }
.dp-content a { color: #00a8fc; text-decoration: none; }
.dp-empty { color: var(--text-dim); font-style: italic; }

/* ── Historique ────────────────────────────────────────────────────────── */

.history { display: flex; flex-direction: column; gap: 6px; }
.hist-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 10px; background: var(--panel-2); border-radius: 4px; font-size: 13px;
}
.hist-status { font-size: 11px; padding: 2px 7px; border-radius: 10px; font-weight: 600; flex-shrink: 0; }
.hist-status.sent { background: rgba(35,165,90,.2); color: var(--green); }
.hist-status.failed { background: rgba(242,63,67,.2); color: var(--red); }
.hist-status.skipped { background: rgba(240,178,50,.2); color: var(--amber); }
.hist-detail { color: var(--text-dim); }

/* ── Boutons ───────────────────────────────────────────────────────────── */

.btn {
  background: var(--line); color: var(--text); border: none; border-radius: 4px;
  padding: 9px 16px; cursor: pointer; font: inherit; font-size: 14px;
}
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: transparent; color: var(--red); }
.btn.danger:hover { background: rgba(242,63,67,.12); }
.btn.ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--text); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }

.editor-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px;
}
.foot-left, .foot-right { display: flex; gap: 8px; }

/* ── Sélecteur d'emojis ────────────────────────────────────────────────── */

.emoji-popup {
  position: fixed; right: 24px; bottom: 24px; width: 320px; max-height: 380px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5); z-index: 50; overflow: auto;
}
.emoji-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.emoji-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.emoji-grid button {
  background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px;
}
.emoji-grid button:hover { background: var(--line); }
.emoji-grid img { width: 26px; height: 26px; display: block; }

/* ── Notification ──────────────────────────────────────────────────────── */

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 12px 18px; border-radius: 6px; z-index: 100; max-width: 520px;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
