/* =========================================================
   YOKASTUDIO — theme "console de studio"
   Palette: charbon chaud + laiton ambre + teal, plaques de rack
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #14110f;
  --panel: #1e1a16;
  --panel-raised: #241f1a;
  --edge: #35302a;
  --text: #ede6dc;
  --muted: #9a9086;
  --amber: #e8a33d;
  --amber-dim: #a97a30;
  --teal: #4bb3ac;
  --danger: #c24f3d;
  --radius: 10px;
  --shadow-deep: 0 10px 30px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(232,163,61,.06), transparent 60%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
.mono { font-family: 'JetBrains Mono', monospace; }
.display {
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------- Layout shells ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--edge);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.brand .led {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px 2px rgba(232,163,61,.7);
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--panel);
  font-size: 14px;
}
.user-chip img { width: 26px; height: 26px; border-radius: 50%; }
.user-chip .logout { color: var(--muted); font-size: 12px; margin-left: 6px; }
.user-chip .logout:hover { color: var(--danger); }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---------- Landing / login ---------- */

.hero {
  min-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}
.hero .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  color: var(--amber);
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(40px, 7vw, 76px);
  line-height: .95;
  letter-spacing: .01em;
  text-transform: uppercase;
  margin: 0 0 18px;
}
.hero h1 span { color: var(--amber); }
.hero p {
  color: var(--muted);
  max-width: 480px;
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: var(--amber);
  color: #191410;
  box-shadow: 0 6px 0 var(--amber-dim), var(--shadow-deep);
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 3px 0 var(--amber-dim); }
.btn-ghost {
  background: transparent;
  border-color: var(--edge);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--amber-dim); }
.btn-sm { padding: 9px 16px; font-size: 13px; }

.rack-strip { margin-top: 56px; display: flex; gap: 10px; }
.rack-strip .screw { width: 4px; height: 4px; border-radius: 50%; background: var(--edge); align-self: center; }
.rack-strip .bar { width: 46px; height: 6px; border-radius: 2px; background: linear-gradient(90deg, var(--panel-raised), var(--edge)); }

/* ---------- Section headers ---------- */

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-head h1 { font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; font-size: 34px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; }

/* ---------- Server grid ---------- */

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.server-jack {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition: border-color .15s, transform .15s;
}
.server-jack:hover { border-color: var(--amber-dim); transform: translateY(-2px); }
.server-jack .ring { width: 64px; height: 64px; border-radius: 50%; padding: 3px; background: conic-gradient(var(--amber), var(--teal), var(--amber)); }
.server-jack .ring img, .server-jack .ring .fallback {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--panel-raised);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px; font-weight: 700;
}
.server-jack .name { font-weight: 600; font-size: 15px; }
.server-jack .status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.status.active { background: rgba(75,179,172,.14); color: var(--teal); }
.status.pending { background: rgba(194,79,61,.14); color: var(--danger); }
.server-jack .invite-btn { margin-top: 4px; font-size: 12px; padding: 6px 14px; }

.empty-state {
  border: 1px dashed var(--edge);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state .display { font-size: 22px; color: var(--text); margin-bottom: 10px; }

/* ---------- Rack modules ---------- */

.module {
  position: relative;
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-deep);
}
.module::before, .module::after {
  content: '';
  position: absolute; top: 10px;
  width: 5px; height: 5px; border-radius: 50%;
  background: #0c0a08;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.08);
}
.module::before { left: 10px; }
.module::after { right: 10px; }

.module-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.module-head .tag { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--amber); letter-spacing: .12em; text-transform: uppercase; }
.module-head h2 { font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; font-size: 22px; margin: 2px 0 0; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=number], .field select, .field textarea {
  width: 100%;
  background: #100d0b;
  border: 1px solid var(--edge);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--amber-dim); }
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row-2 { grid-template-columns: 1fr; } }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--edge); }
.switch-row:first-child { border-top: none; }
.switch-row .label { font-size: 14px; }
.switch-row .desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: #100d0b; border: 1px solid var(--edge); border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch .track::before {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(180deg, #d8d1c6, #a9a196);
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
  transition: transform .15s;
}
.switch input:checked + .track { background: rgba(232,163,61,.25); border-color: var(--amber-dim); }
.switch input:checked + .track::before { transform: translateX(20px); background: linear-gradient(180deg, var(--amber), var(--amber-dim)); }

.save-bar { position: sticky; bottom: 20px; display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.flash { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 22px; }
.flash.ok { background: rgba(75,179,172,.12); border: 1px solid var(--teal); color: var(--teal); }
.flash.err { background: rgba(194,79,61,.12); border: 1px solid var(--danger); color: var(--danger); }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.back-link:hover { color: var(--amber); }

/* ---------- Bot status pill + toolbar ---------- */

.bot-status { display: inline-flex; align-items: center; gap: 7px; font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: .04em; color: var(--muted); }
.bot-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.bot-status.online .dot { background: var(--teal); box-shadow: 0 0 6px 1px rgba(75,179,172,.7); }
.bot-status.online { color: var(--teal); }
.bot-status.offline .dot { background: var(--danger); box-shadow: 0 0 6px 1px rgba(194,79,61,.7); }
.bot-status.offline { color: var(--danger); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.search-input {
  flex: 1; min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}
.search-input:focus { outline: none; border-color: var(--amber-dim); }

.audit-note { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); margin-top: -8px; margin-bottom: 18px; }

.preview-box {
  margin-top: 8px;
  padding: 10px 12px;
  background: #100d0b;
  border: 1px dashed var(--edge);
  border-radius: 7px;
  font-size: 13px;
  color: var(--muted);
}
.preview-box strong { color: var(--text); font-weight: 500; }

.toast {
  position: fixed; top: 18px; right: 18px;
  background: var(--panel-raised);
  border: 1px solid var(--teal);
  color: var(--teal);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-deep);
  z-index: 50;
}

/* ---------- Theme clair (optionnel, sombre par defaut) ---------- */

[data-theme="light"] {
  --bg: #f4efe8;
  --panel: #ffffff;
  --panel-raised: #fbf8f3;
  --edge: #e0d8cb;
  --text: #1f1b16;
  --muted: #6b6157;
  --amber: #b9762a;
  --amber-dim: #8a5a1f;
  --teal: #2f8b84;
  --danger: #ab3d2d;
  --shadow-deep: 0 10px 24px rgba(0,0,0,.08);
}
[data-theme="light"] html, [data-theme="light"] body {
  background: radial-gradient(1200px 600px at 20% -10%, rgba(185,118,42,.05), transparent 60%), var(--bg);
}
[data-theme="light"] .switch .track::before { background: linear-gradient(180deg, #fff, #ddd); }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid var(--edge);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.theme-toggle:hover { border-color: var(--amber-dim); color: var(--amber); }

.lang-switch { display: inline-flex; gap: 2px; border: 1px solid var(--edge); border-radius: 999px; overflow: hidden; }
.lang-switch a { padding: 7px 11px; font-size: 12px; font-family: 'JetBrains Mono', monospace; color: var(--muted); }
.lang-switch a.active { background: var(--amber); color: #191410; font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Feature cards (homepage) ---------- */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.feature-card { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--radius); padding: 20px; text-align: left; }
.feature-card .icon { font-size: 24px; margin-bottom: 10px; }
.feature-card h3 { font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; font-size: 18px; margin: 0 0 6px; }
.feature-card p { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.5; }

.section { max-width: 900px; margin: 60px auto 0; padding: 0 24px; width: 100%; text-align: center; }
.section h2 { font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; font-size: 30px; margin: 0 0 8px; }
.section .sub { color: var(--muted); margin-bottom: 24px; }

/* ---------- Commands page ---------- */

.cmd-toolbar { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.cmd-category { margin-bottom: 30px; }
.cmd-category-title { display: flex; align-items: center; gap: 8px; font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; font-size: 20px; margin-bottom: 12px; }
.cmd-list { display: flex; flex-direction: column; gap: 2px; }
.cmd-row { display: flex; gap: 16px; align-items: baseline; padding: 10px 14px; background: var(--panel); border: 1px solid var(--edge); border-radius: 7px; }
.cmd-row .cmd-name { font-family: 'JetBrains Mono', monospace; color: var(--amber); font-size: 13px; min-width: 160px; }
.cmd-row .cmd-desc { color: var(--muted); font-size: 13px; }

/* ---------- Staff / Founder ---------- */

.founder-badge {
  display: inline-block;
  background: rgba(232,163,61,.15);
  border: 1px solid var(--amber-dim);
  color: var(--amber);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  margin-left: 8px;
}
.staff-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--panel); border: 1px solid var(--edge); border-radius: 8px; margin-bottom: 8px; }
.staff-row .id { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.staff-row .added { font-size: 12px; color: var(--muted); }
.remove-link { color: var(--danger); font-size: 12px; }
.add-staff-form { display: flex; gap: 10px; margin-bottom: 24px; }
.add-staff-form input { flex: 1; }

/* ---------- Stats cards (Panel Fondateur) ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 30px;
  font-weight: 700;
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- Wide server row (Founder "Tous les serveurs") ---------- */

.server-jack-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
}
.new-badge {
  display: inline-block;
  background: rgba(75,179,172,.15);
  border: 1px solid var(--teal);
  color: var(--teal);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---------- Journal / login log ---------- */

.log-list { display: flex; flex-direction: column; gap: 2px; }
.log-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr 1fr;
  gap: 12px;
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--edge);
}
.log-row:last-child { border-bottom: none; }

/* =========================================================
   MODE TELEPHONE — corrige l'empilement/debordement sur petit ecran
   ========================================================= */

@media (max-width: 640px) {
  .topbar {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
  }
  .topbar-actions {
    justify-content: center;
    gap: 8px;
  }
  .brand { justify-content: center; font-size: 18px; }

  .wrap { padding: 20px 14px 60px; }

  .hero { padding: 30px 16px; min-height: auto; }
  .hero h1 { font-size: 36px; }
  .hero p { font-size: 14px; }

  .page-head { flex-direction: column; align-items: stretch; }
  .page-head h1 { font-size: 26px; }

  .module { padding: 18px 16px 16px; }
  .module-head { flex-direction: column; align-items: flex-start; gap: 6px; }

  .row-2 { grid-template-columns: 1fr; }

  .server-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .server-jack { padding: 14px; }
  .server-jack .ring { width: 48px; height: 48px; }

  .server-jack-wide {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
  .server-jack-wide > div:last-child {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 8px;
  }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar > * { width: 100%; }
  .search-input { flex: none; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 24px; }

  .cmd-toolbar { flex-direction: column; }
  .cmd-toolbar select { flex: none !important; width: 100%; }
  .cmd-row { flex-direction: column; gap: 4px; align-items: flex-start; }
  .cmd-row .cmd-name { min-width: 0; }

  .log-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .add-staff-form { flex-direction: column; }

  .save-bar { position: static; justify-content: stretch; }
  .save-bar .btn { width: 100%; justify-content: center; }

  .feature-grid { grid-template-columns: repeat(2, 1fr); }

  .user-chip { width: 100%; justify-content: center; }
  .lang-switch, .theme-toggle { align-self: center; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
}

/* ---------- Favoris ---------- */

.server-jack-container { position: relative; }
.favorite-star-form {
  position: absolute;
  top: 8px;
  right: 8px;
  margin: 0;
}
.favorite-star {
  background: rgba(0,0,0,.35);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.favorite-star.active { color: var(--amber); }
.favorite-star:hover { color: var(--amber); }

/* ---------- Grosse banniere (derniere modif, rejoint le support...) ---------- */

.big-banner {
  font-size: 16px;
  padding: 16px 20px;
}

/* ---------- Barre d'enregistrement unique (reste visible au scroll) ---------- */

.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 20;
}
.save-bar .btn-primary {
  box-shadow: 0 6px 0 var(--amber-dim), 0 8px 24px rgba(0,0,0,.5);
}
@media (max-width: 640px) {
  .save-bar { bottom: 10px; }
}