* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --bg2:       #1a1d27;
  --bg3:       #22263a;
  --border:    #2e3348;
  --text:      #e2e5f0;
  --text2:     #9399b2;
  --primary:   #5865F2;
  --primary-h: #4752c4;
  --success:   #23a55a;
  --danger:    #f23f42;
  --radius:    10px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }

/* ── Navbar ─────────────────────────────────── */
.navbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand { display: flex; align-items: center; gap: 12px; }
.bot-name   { font-size: 18px; font-weight: 700; color: var(--primary); }
.guild-name {
  background: var(--bg3);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text2);
}
.navbar-links { display: flex; align-items: center; gap: 16px; }
.nav-link {
  color: var(--text2);
  font-size: 13px;
  transition: color .2s;
  padding: 4px 8px;
  border-radius: 6px;
}
.nav-link:hover { color: var(--text); background: var(--bg3); }
.user-info { display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; }

/* ── Container ──────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

/* ── Page header ────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-header p  { color: var(--text2); }

/* ── Boutons ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity .2s, background .2s;
  text-decoration: none;
}
.btn:hover { opacity: .85; }
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-discord  { background: #5865F2; color: #fff; padding: 12px 24px; font-size: 15px; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-sm       { padding: 4px 10px; font-size: 12px; }
.btn-full     { width: 100%; justify-content: center; margin-top: 8px; }

/* ── Cards ──────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2 { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Formulaire ─────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
}
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.color-input-row { display: flex; gap: 8px; align-items: center; }
.form-color {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  padding: 2px;
}

/* ── Toggle ─────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--text2);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); border-color: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: #fff; }

/* ── Layout config ──────────────────────────── */
.config-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .config-layout { grid-template-columns: 1fr; }
}

/* ── Variables hint ─────────────────────────── */
.variables-hint {
  display: block;
  font-size: 11px;
  color: var(--text2);
  font-weight: 400;
  margin-top: 2px;
}
.variables-hint code {
  background: var(--bg3);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--primary);
  font-size: 11px;
}

/* ── Discord preview ────────────────────────── */
.discord-preview {
  background: #313338;
  border-radius: 8px;
  padding: 16px;
}
.discord-message { display: flex; gap: 12px; }
.bot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}
.message-content { flex: 1; min-width: 0; }
.message-author {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: #fff;
}
.bot-badge {
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
  font-weight: 500;
}
.embed-preview {
  display: flex;
  border-radius: 4px;
  overflow: hidden;
  background: #2b2d31;
  border: 1px solid rgba(255,255,255,.06);
  max-width: 100%;
}
.embed-bar { width: 4px; flex-shrink: 0; background: var(--primary); }
.embed-body { padding: 10px 12px; flex: 1; min-width: 0; }
.embed-title {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  margin-bottom: 4px;
  word-break: break-word;
}
.embed-desc {
  font-size: 13px;
  color: #dbdee1;
  white-space: pre-wrap;
  word-break: break-word;
}
.embed-footer {
  font-size: 11px;
  color: #949ba4;
  margin-top: 8px;
}
.embed-image img { max-width: 100%; border-radius: 4px; margin-top: 8px; }
.embed-thumbnail { padding: 10px 10px 10px 0; }
.embed-thumbnail img { width: 64px; height: 64px; border-radius: 4px; object-fit: cover; }

.preview-hint { font-size: 11px; color: var(--text2); }

/* ── Variables table ────────────────────────── */
.variables-table { width: 100%; border-collapse: collapse; }
.variables-table tr { border-bottom: 1px solid var(--border); }
.variables-table tr:last-child { border-bottom: none; }
.variables-table td { padding: 7px 4px; font-size: 13px; }
.variables-table code {
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
  font-size: 12px;
}

/* ── Alerts ─────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-success { background: rgba(35,165,90,.15); border: 1px solid var(--success); color: var(--success); }
.alert-danger  { background: rgba(242,63,66,.15);  border: 1px solid var(--danger);  color: var(--danger);  }

/* ── Login page ─────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  max-width: 400px;
  width: 100%;
}
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-card h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.login-card p  { color: var(--text2); margin-bottom: 28px; }

/* ── Guilds grid ────────────────────────────── */
.guilds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.guild-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color .2s, background .2s;
  color: var(--text);
}
.guild-card:hover { border-color: var(--primary); background: var(--bg3); }
.guild-icon img, .guild-icon-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}
.guild-icon-placeholder {
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.guild-info h3   { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.guild-info span { font-size: 12px; color: var(--text2); }

/* ── Empty state ────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h1, .empty-state h2 { color: var(--text); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* ── Footer ─────────────────────────────────── */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text2);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ── Modération ─────────────────────────────── */
.commands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}
.cmd-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cmd-item code {
  color: var(--primary);
  font-size: 12px;
  font-family: monospace;
}
.cmd-item span {
  font-size: 12px;
  color: var(--text2);
}

.table-wrap { overflow-x: auto; }
.sanctions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sanctions-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.sanctions-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.sanctions-table tr:last-child td { border-bottom: none; }
.sanctions-table tr.inactive { opacity: 0.45; }

.sanction-id { color: var(--text2); font-size: 12px; }
.user-tag    { font-size: 12px; }
.reason-text { font-size: 12px; color: var(--text2); max-width: 200px; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.date-text   { font-size: 11px; color: var(--text2); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
}
.badge-ban    { background: rgba(231,76,60,.2);   color: #e74c3c; }
.badge-unban  { background: rgba(46,204,113,.2);  color: #2ecc71; }
.badge-kick   { background: rgba(230,126,34,.2);  color: #e67e22; }
.badge-mute   { background: rgba(149,165,166,.2); color: #95a5a6; }
.badge-unmute { background: rgba(46,204,113,.2);  color: #2ecc71; }
.badge-warn   { background: rgba(243,156,18,.2);  color: #f39c12; }
.badge-unwarn { background: rgba(46,204,113,.2);  color: #2ecc71; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}
.status-badge.active   { background: rgba(46,204,113,.15); color: #2ecc71; }
.status-badge.inactive { background: rgba(149,165,166,.15); color: #95a5a6; }

/* ── Permissions rôles ──────────────────────── */
.roles-perms-list { display: flex; flex-direction: column; gap: 16px; }
.role-perm-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.role-perm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.role-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.perms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.perm-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color .2s;
  font-size: 12px;
}
.perm-checkbox:hover { border-color: var(--primary); }
.perm-checkbox input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; }
.perm-checkbox input:checked + span { color: var(--primary); font-weight: 600; }

/* ── Modlogs ────────────────────────────────── */
.current-channel-info {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.channel-name { font-weight: 600; color: var(--primary); }
.role-badge-sm {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  margin: 2px;
}
.mode-btn { transition: background .2s, color .2s; color: var(--text); }
.mode-btn:hover { opacity: 1 !important; }

/* ── Twitch autocomplete ────────────────────── */
.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .15s;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--bg3); }
.autocomplete-item img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}