:root {
  --bg:        #1a1b1e;
  --bg-2:      #232428;
  --bg-3:      #2b2d31;
  --bg-4:      #313338;
  --line:      #3a3c41;
  --blurple:   #5865f2;
  --blurple-h: #4752c4;
  --text:      #e3e5e8;
  --text-dim:  #9a9ea3;
  --green:     #23a55a;
  --grey:      #6d6f78;
  --red:       #f23f42;
  --yellow:    #f0b232;
  --radius:    12px;
  --shadow:    0 4px 20px rgba(0,0,0,.25);
}

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

body {
  font-family: 'gg sans','Segoe UI',system-ui,-apple-system,sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #2a2140 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--blurple); text-decoration: none; }
code { background: var(--bg); padding: 2px 6px; border-radius: 5px; font-size: 13px; }

/* ---------- NAVBAR ---------- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px; background: rgba(24,25,28,.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
}
.nav .brand { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: .3px; }
.nav .brand span { color: var(--blurple); }
.nav-user { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.nav-user img { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--blurple); }

/* ---------- BOUTONS ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px; border: none; cursor: pointer;
  background: var(--blurple); color: #fff; font-weight: 700; font-size: 15px;
  transition: transform .08s, background .15s, box-shadow .15s;
}
.btn:hover { background: var(--blurple-h); box-shadow: 0 4px 14px rgba(88,101,242,.4); }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: var(--bg-4); }
.btn-secondary:hover { background: #40434a; box-shadow: none; }
.btn-green { background: var(--green); }
.btn-green:hover { background: #1e8f4e; box-shadow: 0 4px 14px rgba(35,165,90,.4); }

/* ---------- HERO (accueil) ---------- */
.hero { text-align: center; padding: 90px 24px 40px; }
.hero h1 { font-size: 52px; color: #fff; margin-bottom: 16px; letter-spacing: -1px; }
.hero p { font-size: 18px; color: var(--text-dim); max-width: 580px; margin: 0 auto 32px; }
.features {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
  gap: 18px; max-width: 960px; margin: 60px auto 0;
}
.feature {
  background: var(--bg-2); padding: 24px; border-radius: var(--radius);
  text-align: left; border: 1px solid var(--line);
}
.feature h3 { color: #fff; margin-bottom: 8px; font-size: 17px; }
.feature p { font-size: 14px; margin: 0; }

/* ---------- GRILLE DE SERVEURS ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 40px 24px; }
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 18px; }
.guild-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; text-align: center; color: var(--text);
  transition: transform .12s, border-color .12s;
}
.guild-card:hover { transform: translateY(-4px); border-color: var(--blurple); }
.guild-card img, .guild-icon {
  width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 12px; display: block;
}
.guild-icon {
  background: linear-gradient(135deg,var(--blurple),#8b5cf6); color: #fff;
  font-size: 30px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.guild-card h3 { color: #fff; font-size: 15px; }

/* ---------- PAGE DE CONFIG : LAYOUT ---------- */
.manage-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.manage-header h1 { color: #fff; font-size: 26px; }
.back { color: var(--text-dim); display: inline-block; margin-bottom: 16px; font-weight: 600; }
.back:hover { color: #fff; }

.layout { display: grid; grid-template-columns: 230px 1fr; gap: 24px; align-items: start; }

/* Menu de sections (gauche) */
.tabs {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; position: sticky; top: 84px;
}
.tab-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 14px; border: none; background: transparent; color: var(--text-dim);
  font-weight: 600; font-size: 14px; border-radius: 8px; cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.tab-btn:hover { background: var(--bg-3); color: var(--text); }
.tab-btn.active { background: var(--blurple); color: #fff; }
.tab-btn .ico { font-size: 17px; }

/* Contenu des sections (droite) */
.tab-panel { display: none; animation: fade .2s ease; }
.tab-panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.card h2 { color: #fff; font-size: 18px; margin-bottom: 4px; display: flex; align-items: center; gap: 9px; }
.card .desc { color: var(--text-dim); font-size: 14px; margin-bottom: 20px; }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-weight: 700; margin-bottom: 7px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: #c4c7cc; }
.field small { color: var(--text-dim); font-weight: 400; text-transform: none; letter-spacing: 0; }
input[type="text"], input[type="number"], textarea, select {
  width: 100%; padding: 11px 14px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit;
  transition: border-color .12s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blurple); }
textarea { resize: vertical; min-height: 84px; }

/* Interrupteur (switch) façon Discord */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.switch-row:not(:last-child) { border-bottom: 1px solid var(--line); }
.switch-row .lbl { font-weight: 600; font-size: 15px; }
.switch-row .lbl small { display: block; color: var(--text-dim); font-weight: 400; font-size: 13px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--grey); border-radius: 26px;
  cursor: pointer; transition: background .18s;
}
.slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .18s;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Sélecteur de couleur du bouton (façon MEE6) */
.color-picker { display: flex; gap: 12px; }
.color-picker label {
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer; position: relative;
  border: 2px solid transparent; transition: transform .1s;
}
.color-picker label:hover { transform: scale(1.08); }
.color-picker input { position: absolute; opacity: 0; }
.color-picker input:checked + span::after {
  content: "✓"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 800; font-size: 18px;
}
.color-picker span { position: absolute; inset: 0; border-radius: 8px; }
.c-Primary span   { background: var(--blurple); }
.c-Secondary span { background: var(--grey); }
.c-Success span   { background: var(--green); }
.c-Danger span    { background: var(--red); }

/* Barre d'enregistrement */
.save-bar {
  position: sticky; bottom: 16px; margin-top: 24px;
  background: rgba(43,45,49,.92); backdrop-filter: blur(8px);
  border: 1px solid var(--line); padding: 14px 20px; border-radius: var(--radius);
  display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow);
}
.save-bar span { color: var(--text-dim); font-size: 14px; }
.alert-saved {
  background: var(--green); color: #fff; padding: 13px 18px;
  border-radius: 10px; margin-bottom: 20px; font-weight: 700;
}
.hint { background: var(--bg); border-left: 3px solid var(--blurple); padding: 12px 14px; border-radius: 6px; font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }

@media (max-width: 780px) {
  .layout { grid-template-columns: 1fr; }
  .tabs { position: static; display: flex; overflow-x: auto; }
  .tab-btn { white-space: nowrap; }
}

/* ---------- TICKETS : liste des panneaux ---------- */
.panel-row {
  display: flex; align-items: center; gap: 16px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 12px; color: var(--text); transition: border-color .12s, transform .1s;
}
.panel-row:hover { border-color: var(--blurple); transform: translateX(3px); }
.panel-color { width: 6px; height: 40px; border-radius: 4px; flex-shrink: 0; }
.panel-name { font-weight: 700; color: #fff; font-size: 16px; }
.panel-sub { color: var(--text-dim); font-size: 13px; }
.panel-go { color: var(--blurple); font-weight: 700; font-size: 14px; }

/* ---------- ÉDITEUR : grille 2 colonnes ---------- */
.editor-grid { display: grid; grid-template-columns: 1fr 420px; gap: 24px; align-items: start; }
@media (max-width: 960px) { .editor-grid { grid-template-columns: 1fr; } }

input[type="color"] { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; }

/* Puces de rôles (multi-sélection) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 20px;
  cursor: pointer; font-size: 13px; font-weight: 600; transition: background .1s, border-color .1s;
}
.chip span { color: var(--rc, #99aab5); }
.chip input { accent-color: var(--blurple); }
.chip:has(input:checked) { background: rgba(88,101,242,.15); border-color: var(--blurple); }

/* ---------- APERÇU STYLE DISCORD ---------- */
.preview-wrap { position: sticky; top: 84px; background: #313338; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.preview-label { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--text-dim); margin-bottom: 14px; }
.dc-msg { display: flex; gap: 14px; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg,var(--blurple),#8b5cf6); flex-shrink: 0; }
.dc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dc-name { color: #f2f3f5; font-weight: 600; font-size: 15px; }
.dc-bot { background: var(--blurple); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.dc-embed { background: #2b2d31; border-left: 4px solid var(--blurple); border-radius: 5px; padding: 12px 16px; margin-bottom: 8px; max-width: 100%; }
.dc-embed-title { color: #fff; font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.dc-embed-desc { color: #dbdee1; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.dc-embed-img { max-width: 100%; border-radius: 5px; margin-top: 10px; display: block; }
.dc-btn { border: none; color: #fff; background: #5865f2; padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: default; }

/* ---------- ÉDITEUR TICKET : barre haute ---------- */
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.topback { color: var(--text-dim); font-size: 22px; text-decoration: none; }
.title-input {
  flex: 1; min-width: 200px; background: transparent; border: none; color: #fff;
  font-size: 26px; font-weight: 800; padding: 6px 4px; border-radius: 8px;
}
.title-input:hover, .title-input:focus { background: var(--bg-2); outline: none; }
.topactions { display: flex; gap: 10px; }

/* Éditeur de bouton */
.btn-editor { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 12px; }
.mini-del { background: transparent; border: none; color: #f77; cursor: pointer; font-size: 13px; font-weight: 600; }
.mini-del:hover { text-decoration: underline; }

/* Chip admin */
.chip.is-admin { border-color: var(--yellow); }

/* Aperçu : contenu, thumbnail, footer, boutons */
.dc-content { color: #dbdee1; font-size: 15px; margin-bottom: 8px; white-space: pre-wrap; word-break: break-word; }
.dc-thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.dc-footer { color: #b5bac1; font-size: 12px; margin-top: 8px; }
.dc-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-btns .dc-btn { display: inline-block; }

/* ---------- ÉDITEUR WYSIWYG (message façon Discord, éditable) ---------- */
.wz-msg { display: flex; gap: 14px; background: #313338; border-radius: 8px; padding: 16px; }
.wz-avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg,var(--blurple),#8b5cf6); flex-shrink: 0; }
.wz-head { color: #f2f3f5; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.wz-bot { background: var(--blurple); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 4px; }

.wz-edit { outline: none; border-radius: 4px; padding: 2px 4px; white-space: pre-wrap; word-break: break-word; }
.wz-edit:hover { background: rgba(255,255,255,.03); }
.wz-edit:focus { background: rgba(88,101,242,.10); box-shadow: 0 0 0 1px var(--blurple); }
.wz-edit:empty:before { content: attr(data-ph); color: #72767d; pointer-events: none; }

.wz-content { color: #dbdee1; font-size: 15px; margin-bottom: 8px; min-height: 22px; }

.wz-embed { position: relative; background: #2b2d31; border-radius: 5px; padding: 12px 16px 12px 20px; }
.wz-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: 5px 0 0 5px; background: var(--blurple); cursor: pointer; }
.wz-embed-inner { }
.wz-title { color: #fff; font-weight: 700; font-size: 16px; min-height: 20px; margin-bottom: 4px; }
.wz-desc { color: #dbdee1; font-size: 14px; min-height: 20px; }
.wz-footer { color: #b5bac1; font-size: 12px; margin-top: 10px; min-height: 16px; }

.wz-thumb {
  width: 80px; height: 80px; border-radius: 8px; flex-shrink: 0; cursor: pointer;
  border: 2px dashed #4e5058; background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; color: #72767d; font-size: 22px;
}
.wz-thumb:before { content: "🖼️"; }
.wz-thumb.has { border-style: solid; }
.wz-thumb.has:before { content: ""; }

.wz-image {
  margin-top: 12px; min-height: 90px; border-radius: 8px; cursor: pointer;
  border: 2px dashed #4e5058; background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
}
.wz-image.has { border-style: solid; min-height: 180px; }
.wz-image.has .wz-img-ph { display: none; }
.wz-img-ph { color: #72767d; font-size: 14px; }
