:root {
  --font: 'Poppins', system-ui, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --pink: #ff5da2;
  --pink-soft: #ff8ac3;
  --pink-deep: #e8438f;
  --sidebar-w: 264px;
}

[data-theme='dark'] {
  --bg: #0a0a0f;
  --bg-side: #111119;
  --bg-card: #15151e;
  --bg-soft: #1b1b26;
  --border: rgba(255, 255, 255, 0.07);
  --text: #f3f3f7;
  --muted: #9a9aa8;
  --pink-glow: rgba(255, 93, 162, 0.14);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --chip: rgba(255, 255, 255, 0.05);
}

[data-theme='light'] {
  --bg: #faf7f9;
  --bg-side: #ffffff;
  --bg-card: #ffffff;
  --bg-soft: #fbf1f6;
  --border: #f1d9e4;
  --text: #191922;
  --muted: #7c7c88;
  --pink-glow: rgba(236, 72, 153, 0.1);
  --shadow: 0 18px 44px rgba(180, 90, 130, 0.16);
  --chip: rgba(236, 72, 153, 0.07);
}

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

[hidden] { display: none !important; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  transition: background 0.35s ease, color 0.35s ease;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 88% -8%, var(--pink-glow), transparent 60%),
    radial-gradient(520px 360px at 0% 102%, var(--pink-glow), transparent 60%);
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 20;
  transition: transform 0.3s ease, background 0.35s ease;
}

.side-brand { display: flex; align-items: center; gap: 12px; }
.side-brand strong { display: block; font-size: 16px; line-height: 1.25; }
.brand-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  color: #fff; box-shadow: 0 8px 22px var(--pink-glow);
}
.brand-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.brand-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa0aa; }
.status-dot.online { background: #35d07f; box-shadow: 0 0 8px #35d07f; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; text-align: left; transition: 0.2s ease;
}
.nav-item span { font-size: 17px; }
.nav-item:hover { background: var(--chip); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  color: #fff;
  box-shadow: 0 10px 26px var(--pink-glow);
}

.side-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.logout-btn { width: 100%; justify-content: center; text-align: center; }

/* Switch thème */
.switch { position: relative; display: inline-block; width: 60px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--chip);
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
  transition: 0.3s; display: flex; align-items: center; padding: 0 7px;
}
.slider .switch-icons { font-size: 11px; width: 100%; display: flex; justify-content: space-between; }
.slider:before {
  content: ''; position: absolute; width: 22px; height: 22px;
  left: 4px; top: 3px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep)); transition: 0.3s;
}
.switch input:checked + .slider:before { transform: translateX(30px); }

/* ---------------- Main ---------------- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 20px 30px 60px;
  position: relative;
  z-index: 1;
  min-width: 0;
}

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 0 22px;
}
.topbar h1 { font-size: 22px; font-weight: 700; flex: 1; }
.top-ping {
  font-size: 12.5px; font-weight: 600; color: var(--pink);
  background: var(--pink-glow); padding: 7px 14px; border-radius: 999px;
}
.menu-toggle {
  display: none; background: var(--chip); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; font-size: 18px;
  width: 42px; height: 42px; cursor: pointer;
}

.view { display: none; animation: fade 0.35s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hero { margin: 6px 0 28px; }
.eyebrow {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--pink); background: var(--pink-glow);
  padding: 6px 12px; border-radius: 999px; margin-bottom: 14px;
}
.hero h2 { font-size: clamp(22px, 3.4vw, 32px); font-weight: 800; letter-spacing: -0.5px; }
.hero-sub { margin-top: 12px; color: var(--muted); max-width: 680px; line-height: 1.7; font-size: 15px; }

/* ---------------- Stats ---------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--pink); }
.stat-icon { font-size: 24px; }
.stat-card p { font-size: 21px; font-weight: 700; }
.stat-card span { font-size: 12.5px; color: var(--muted); }

/* ---------------- Panels ---------------- */
.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
  transition: background 0.35s ease, border-color 0.35s ease;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.panel h3 { font-size: 17px; font-weight: 700; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.6; }
.hint code { background: var(--chip); padding: 2px 6px; border-radius: 6px; color: var(--pink); font-size: 12px; }

.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.quick-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-radius: var(--radius-sm);
  background: var(--chip); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: 0.22s ease;
}
.quick-btn span { font-size: 18px; }
.quick-btn:hover { border-color: var(--pink); transform: translateY(-2px); box-shadow: var(--shadow); }

/* ---------------- Inputs ---------------- */
.search, .input, .select {
  background: var(--chip); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 11px 15px; font-family: var(--font); font-size: 14px;
  outline: none; transition: border-color 0.25s ease, box-shadow 0.25s ease;
  width: 100%;
}
.search:focus, .input:focus, .select:focus { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-glow); }
.search { width: 280px; }
.select { cursor: pointer; }
.select option { background: var(--bg-card); color: var(--text); }
label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 7px; }

.btn {
  font-family: var(--font); font-size: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  border: none; border-radius: var(--radius-sm); padding: 12px 26px;
  cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px var(--pink-glow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--chip); color: var(--text); border: 1px solid var(--border); }
.btn.small { padding: 8px 14px; font-size: 12.5px; }

/* ---------------- Tabs / cards ---------------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  padding: 8px 15px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--chip); color: var(--muted); font-family: var(--font);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.25s ease;
}
.tab:hover { color: var(--text); border-color: var(--pink); }
.tab.active { background: linear-gradient(135deg, var(--pink), var(--pink-deep)); color: #fff; border-color: transparent; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--pink); box-shadow: var(--shadow); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-top h4 { font-size: 15px; font-weight: 700; }
.card-name { color: var(--pink); }
.card p { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.card .usage {
  font-size: 12px; background: var(--chip); border: 1px dashed var(--border);
  border-radius: 8px; padding: 7px 11px; color: var(--pink); display: inline-block; margin-bottom: 10px;
}
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; padding: 4px 9px; border-radius: 999px; }
.badge.moderation { background: rgba(236, 72, 153, 0.12); color: var(--pink); }
.badge.utile { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.badge.fun { background: rgba(250, 204, 21, 0.12); color: #eab308; }
.badge.economie { background: rgba(34, 197, 94, 0.14); color: #4ade80; }
.badge.social { background: rgba(168, 85, 247, 0.14); color: #c084fc; }
[data-theme='light'] .badge.utile { color: #2f7de0; }
[data-theme='light'] .badge.fun { color: #c98a00; }
[data-theme='light'] .badge.economie { color: #1fa354; }
[data-theme='light'] .badge.social { color: #9b46e8; }

.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* ---------------- Serveurs ---------------- */
.server-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.server-list { max-height: 76vh; overflow-y: auto; }
.guild-list { display: flex; flex-direction: column; gap: 8px; }
.guild-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--chip); cursor: pointer; transition: 0.2s ease;
}
.guild-item:hover { border-color: var(--pink); }
.guild-item.active { border-color: var(--pink); background: var(--pink-glow); }
.guild-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep)); overflow: hidden;
}
.guild-icon img { width: 100%; height: 100%; object-fit: cover; }
.guild-meta strong { display: block; font-size: 13.5px; }
.guild-meta span { font-size: 11.5px; color: var(--muted); }

.detail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.detail-head .guild-icon { width: 60px; height: 60px; border-radius: 16px; font-size: 24px; }
.detail-head h3 { font-size: 20px; }
.detail-head .hint { display: block; }

.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 20px; }
.mini-stat { background: var(--chip); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.mini-stat strong { font-size: 18px; display: block; }
.mini-stat span { font-size: 11.5px; color: var(--muted); }

.subtabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--chip); border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; font-size: 12.5px; }
.chip.role { border-left: 3px solid var(--pink); }

.member-rows, .channel-rows, .ban-rows { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--chip); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.row .avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg-soft); }
.row .avatar.placeholder { display: grid; place-items: center; color: var(--muted); font-size: 15px; }
.row .grow { flex: 1; min-width: 0; }
.row .grow strong { font-size: 13.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .grow span { font-size: 11.5px; color: var(--muted); }
.row .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-btn {
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: 0.2s ease; font-family: var(--font);
}
.icon-btn:hover { border-color: var(--pink); color: var(--pink); }
.icon-btn.danger:hover { border-color: #f87171; color: #f87171; }
.channel-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--chip); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.channel-row .grow { flex: 1; }
.channel-row strong { font-size: 13px; }
.channel-row small { color: var(--muted); font-size: 11px; }

/* ---------------- Console ---------------- */
.console-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 14px 0; }
.console-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 6px; }
.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--pink); }

.output { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg-out {
  border: 1px solid var(--border); border-left: 4px solid var(--pink);
  background: var(--bg-soft); border-radius: var(--radius-sm); padding: 14px 16px;
  font-size: 14px; line-height: 1.65; white-space: pre-line;
}
.msg-out .embed { border-left: 4px solid var(--pink); padding-left: 14px; margin-top: 8px; }
.msg-out .embed h5 { font-size: 14px; margin-bottom: 6px; }
.msg-out .embed .fields { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.msg-out .embed .field strong { color: var(--pink); font-size: 12.5px; }
.msg-out .embed .field span { font-size: 13px; color: var(--text); display: block; }
.msg-out .embed small { color: var(--muted); font-size: 11.5px; }
.output .error-box { border-left-color: #f87171; }

/* ---------------- Activité (présence) ---------------- */
.activity-preview {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--border); border-left: 4px solid var(--pink);
  background: var(--bg-soft); border-radius: var(--radius-sm);
  padding: 16px 18px; margin: 14px 0; font-size: 15px; font-weight: 600;
}
.preview-dot { width: 12px; height: 12px; border-radius: 50%; background: #9aa0aa; flex-shrink: 0; }
.preview-dot.online { background: #35d07f; box-shadow: 0 0 10px #35d07f; }
.preview-dot.idle { background: #f0b429; box-shadow: 0 0 10px #f0b429; }
.preview-dot.dnd { background: #f87171; box-shadow: 0 0 10px #f87171; }
.preview-dot.invisible { background: #9aa0aa; }
#previewText em { color: var(--pink); font-style: normal; }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; }
tbody tr:hover { background: var(--chip); }
td.rank { font-weight: 700; color: var(--pink); }

.warn-list { display: flex; flex-direction: column; gap: 12px; }
.warn-card { background: var(--chip); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.warn-card .warn-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.warn-item { font-size: 13px; padding: 8px 0; border-top: 1px dashed var(--border); color: var(--muted); }
.warn-item strong { color: var(--text); }

/* ---------------- Réglages serveur (bienvenue / rôle auto) ---------------- */
.settings-form { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.settings-form label { font-size: 12.5px; }
.settings-form textarea.input { resize: vertical; font-family: var(--font); line-height: 1.5; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type='color'].input { padding: 4px; height: 44px; cursor: pointer; }

/* ---------------- Musique ---------------- */
.now-playing {
  display: flex; align-items: center; gap: 18px;
  border: 1px solid var(--border); border-left: 4px solid var(--pink);
  background: var(--bg-soft); border-radius: var(--radius-sm);
  padding: 18px; margin: 18px 0;
}
.np-art {
  width: 96px; height: 96px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 38px; overflow: hidden;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep)); color: #fff;
}
.np-art img { width: 100%; height: 100%; object-fit: cover; }
.np-body { flex: 1; min-width: 0; }
.np-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.progress { height: 7px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(135deg, var(--pink), var(--pink-deep)); transition: width 0.5s linear; }
.np-times { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.vol-control { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.vol-control input[type='range'] { width: 130px; accent-color: var(--pink); }
.vol-control span { min-width: 38px; }

.search-add { display: flex; gap: 10px; margin-top: 18px; }
.search-add .input { flex: 1; }

.queue-list { display: flex; flex-direction: column; gap: 8px; }
.queue-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--chip); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.queue-index {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--pink-glow); color: var(--pink);
}
.queue-row .grow { flex: 1; min-width: 0; }
.queue-row .grow strong { font-size: 13.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-row .grow span { font-size: 11.5px; color: var(--muted); }

/* ---------------- Modal / toast ---------------- */
.login-screen {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}
.login-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 34px 30px;
  width: min(380px, 90vw); display: flex; flex-direction: column; gap: 14px;
  align-items: center; text-align: center; box-shadow: var(--shadow);
}
.login-box .brand-avatar { width: 62px; height: 62px; font-size: 30px; }
.login-box h2 { font-size: 20px; font-weight: 700; }
.login-box .hint { margin-bottom: 4px; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,0.55); backdrop-filter: blur(3px); }
.modal-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; width: min(440px, 92vw); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--pink); color: var(--text);
  padding: 13px 22px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow); z-index: 60; max-width: 90vw; text-align: center;
}
.toast.err { border-color: #f87171; }

.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 20px 0 10px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1000px) {
  .server-layout { grid-template-columns: 1fr; }
  .server-list { max-height: none; }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .main { margin-left: 0; padding: 18px 18px 50px; }
  .menu-toggle { display: grid; place-items: center; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .search { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
  .search-add { flex-direction: column; }
  .now-playing { flex-direction: column; text-align: center; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
}

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