/* ============================================================
   Gestickets — Design system « Aurora »
   Thème sombre premium, glassmorphism, dégradés violet → cyan
   ============================================================ */
:root {
  --bg: #0b1020;
  --bg-2: #0e1530;
  --card: rgba(255, 255, 255, .04);
  --card-solid: #131a33;
  --border: rgba(255, 255, 255, .09);
  --txt: #e7eaf6;
  --muted: #8b93b8;
  --primary: #7c3aed;
  --primary-2: #a78bfa;
  --accent: #06b6d4;
  --gold: #f59e0b;
  --ok: #10b981;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 16px;
  --grad: linear-gradient(135deg, #7c3aed, #06b6d4);
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  font-size: 15px;
}
/* Fond aurora animé */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(600px 400px at 15% -5%, rgba(124, 58, 237, .22), transparent 60%),
    radial-gradient(700px 500px at 90% 10%, rgba(6, 182, 212, .14), transparent 60%),
    radial-gradient(500px 500px at 60% 110%, rgba(245, 158, 11, .08), transparent 60%),
    var(--bg);
}
a { color: var(--primary-2); text-decoration: none; }
a:hover { color: #c4b5fd; }
img { max-width: 100%; }

/* ---------- Layout application ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: rgba(11, 16, 32, .8); backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.sidebar .brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: contain; background: #fff; padding: 3px; }
.sidebar .brand b { font-size: 17px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-sec { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500; margin-bottom: 2px; transition: .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .05); color: var(--txt); }
.nav-link.active { background: linear-gradient(135deg, rgba(124, 58, 237, .25), rgba(6, 182, 212, .12)); color: #fff; box-shadow: inset 0 0 0 1px rgba(167, 139, 250, .25); }
.nav-link .ico { width: 20px; text-align: center; }
.sidebar .foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.topbar h1 { font-size: 23px; font-weight: 800; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.userchip { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border); padding: 7px 14px 7px 8px; border-radius: 999px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: #fff; }

/* ---------- Cartes ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; backdrop-filter: blur(10px);
}
.card + .card { margin-top: 18px; }
.card h2 { font-size: 16px; margin-bottom: 14px; }
.card .hint { color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stat { position: relative; overflow: hidden; }
.stat .n { font-size: 27px; font-weight: 800; margin: 4px 0 2px; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat .ic { position: absolute; right: 16px; top: 14px; font-size: 26px; opacity: .7; }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); border-radius: 3px; }

/* ---------- Formulaires ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: #c3c9e0; }
input, select, textarea {
  width: 100%; background: rgba(255, 255, 255, .05); border: 1px solid var(--border);
  border-radius: 10px; color: var(--txt); padding: 11px 14px; font-size: 14px; font-family: inherit;
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(124, 58, 237, .2); }
select option { background: var(--card-solid); }
input[type="checkbox"] { width: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .row2, .row3 { grid-template-columns: 1fr; } }

/* Interrupteur (toggle) */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: rgba(255,255,255,.12); border-radius: 999px; cursor: pointer; transition: .2s; }
.switch .sl::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .sl { background: var(--grad); }
.switch input:checked + .sl::before { transform: translateX(20px); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.opt-row:last-child { border-bottom: none; }
.opt-row .t { font-weight: 600; font-size: 14px; }
.opt-row .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  padding: 11px 20px; border-radius: 10px; font-size: 14px; font-weight: 700; font-family: inherit;
  background: var(--grad); color: #fff; transition: .15s; text-decoration: none;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); color: #fff; }
.btn.ghost { background: rgba(255, 255, 255, .06); border: 1px solid var(--border); color: var(--txt); }
.btn.gold { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.btn.ok { background: linear-gradient(135deg, #10b981, #06b6d4); }
.btn.sm { padding: 7px 13px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Tables ---------- */
.tablewrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tb th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tb td { padding: 12px; border-bottom: 1px solid rgba(255, 255, 255, .05); vertical-align: middle; }
.tb tr:hover td { background: rgba(255, 255, 255, .025); }

/* ---------- Badges ---------- */
.bdg { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.bdg.ok    { background: rgba(16, 185, 129, .15); color: #34d399; }
.bdg.warn  { background: rgba(245, 158, 11, .15); color: #fbbf24; }
.bdg.err   { background: rgba(239, 68, 68, .15); color: #f87171; }
.bdg.info  { background: rgba(6, 182, 212, .15); color: #22d3ee; }
.bdg.viol  { background: rgba(124, 58, 237, .18); color: #c4b5fd; }
.bdg.mut   { background: rgba(255, 255, 255, .08); color: var(--muted); }

/* ---------- Flash ---------- */
.flash { padding: 13px 18px; border-radius: 12px; margin-bottom: 18px; font-size: 14px; font-weight: 600; border: 1px solid; }
.flash.success { background: rgba(16, 185, 129, .12); border-color: rgba(16, 185, 129, .4); color: #34d399; }
.flash.warning { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .4); color: #fbbf24; }
.flash.error   { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .4); color: #f87171; }
.flash.info    { background: rgba(6, 182, 212, .12); border-color: rgba(6, 182, 212, .4); color: #22d3ee; }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; background: var(--card); border: 1px solid var(--border); padding: 6px; border-radius: 12px; }
.tabs a { padding: 9px 16px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.tabs a.active { background: var(--grad); color: #fff; }
.tabs a:hover:not(.active) { background: rgba(255, 255, 255, .06); color: var(--txt); }

/* ---------- Pages d'authentification ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px 16px; }
.auth-card { width: 100%; max-width: 440px; background: rgba(19, 26, 51, .8); backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: 22px; padding: 38px 34px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 560px; }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo img { width: 68px; height: 68px; border-radius: 18px; background: #fff; padding: 6px; object-fit: contain; }
.auth-logo h1 { font-size: 22px; margin-top: 12px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.auth-foot { text-align: center; margin-top: 20px; color: var(--muted); font-size: 13.5px; }

/* Force du mot de passe */
.pw-meter { height: 5px; background: rgba(255, 255, 255, .08); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: 4px; transition: .25s; }
.pw-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* Code OTP */
.otp-row { display: flex; gap: 9px; justify-content: center; margin: 18px 0; }
.otp-row input { width: 48px; height: 56px; text-align: center; font-size: 24px; font-weight: 800; }

/* ---------- Divers ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .big { font-size: 42px; margin-bottom: 10px; }
.progress { height: 7px; background: rgba(255, 255, 255, .08); border-radius: 5px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--grad); border-radius: 5px; }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.copy-link { display: flex; gap: 8px; }
.copy-link input { font-family: monospace; font-size: 12.5px; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* Sélecteur de modèles de billets */
.tpl-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tpl-pick label { margin: 0; cursor: pointer; }
.tpl-pick input { display: none; }
.tpl-pick .tile { border: 2px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; transition: .15s; }
.tpl-pick input:checked + .tile { border-color: var(--primary-2); background: rgba(124, 58, 237, .12); box-shadow: 0 0 0 3px rgba(124, 58, 237, .18); }
.tpl-pick .sw { height: 52px; border-radius: 8px; margin-bottom: 9px; }
.sw.aurora  { background: linear-gradient(135deg, #7c3aed, #06b6d4); }
.sw.gold    { background: linear-gradient(135deg, #1a1a1a, #b8860b, #ffd700); }
.sw.neon    { background: linear-gradient(135deg, #ff0080, #7928ca, #00d4ff); }
.sw.minimal { background: linear-gradient(135deg, #f8fafc, #cbd5e1); }
.sw.kente   { background: repeating-linear-gradient(45deg, #b45309 0 10px, #dc2626 10px 20px, #16a34a 20px 30px, #eab308 30px 40px); }
.tpl-pick .nm { font-weight: 700; font-size: 13px; }
.tpl-pick .ds { font-size: 11px; color: var(--muted); margin-top: 3px; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; overflow-x: auto; align-items: center; gap: 4px; padding: 10px; }
  .sidebar .brand { padding: 0 10px 0 0; }
  .sidebar .foot, .nav-sec { display: none; }
  .nav-link { white-space: nowrap; padding: 8px 12px; }
  .main { padding: 18px 14px 50px; }
}
@media print {
  body::before { display: none; }
  .sidebar, .topbar, .noprint { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; }
}

/* ============================================================
   THÈME CLAIR — activé via <html data-theme="light">
   ============================================================ */
:root[data-theme="light"] {
  --bg: #eef1f9;
  --bg-2: #e4e8f5;
  --card: rgba(255, 255, 255, .75);
  --card-solid: #ffffff;
  --border: rgba(15, 23, 42, .12);
  --txt: #0f172a;
  --muted: #5b6485;
  --shadow: 0 10px 34px rgba(30, 41, 90, .14);
}
:root[data-theme="light"] body::before {
  background:
    radial-gradient(600px 400px at 15% -5%, rgba(124, 58, 237, .12), transparent 60%),
    radial-gradient(700px 500px at 90% 10%, rgba(6, 182, 212, .10), transparent 60%),
    radial-gradient(500px 500px at 60% 110%, rgba(245, 158, 11, .07), transparent 60%),
    var(--bg);
}
:root[data-theme="light"] .sidebar { background: rgba(255, 255, 255, .82); }
:root[data-theme="light"] .auth-card { background: rgba(255, 255, 255, .88); }
:root[data-theme="light"] .nav-link:hover { background: rgba(15, 23, 42, .05); }
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea {
  background: rgba(15, 23, 42, .04); color: var(--txt);
}
:root[data-theme="light"] select option { background: #fff; color: #0f172a; }
:root[data-theme="light"] label { color: #33415c; }
:root[data-theme="light"] .btn.ghost { color: var(--txt); }
:root[data-theme="light"] .switch .sl { background: rgba(15, 23, 42, .18); }
:root[data-theme="light"] .bdg.mut { background: rgba(15, 23, 42, .07); color: #5b6485; }
:root[data-theme="light"] .tb tr:hover td { background: rgba(15, 23, 42, .03); }
:root[data-theme="light"] .tabs a:hover:not(.active) { background: rgba(15, 23, 42, .05); }
:root[data-theme="light"] .tk { --page-bg: #eef1f9; }

/* Bouton flottant de bascule de thème */
#themeToggle {
  position: fixed; bottom: 20px; right: 20px; z-index: 999;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--card-solid); color: var(--txt); font-size: 20px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .15s;
  display: flex; align-items: center; justify-content: center;
}
#themeToggle:hover { transform: scale(1.1); }
@media print { #themeToggle { display: none !important; } }

/* ---------- Sélecteur des 50 designs ---------- */
.tpl-scroll {
  max-height: 320px; overflow-y: auto; padding: 4px;
  border: 1px solid var(--border); border-radius: 12px;
}
.tpl-pick .sw { display: flex; align-items: center; justify-content: center; }

/* ---------- Aperçu de police ---------- */
.font-preview {
  margin-top: 10px; padding: 14px 18px; border: 1px dashed var(--border); border-radius: 10px;
  font-size: 22px; text-align: center; color: var(--txt); min-height: 56px;
}

/* ---------- Œil afficher/masquer le mot de passe ---------- */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-wrap .pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 17px;
  opacity: .65; padding: 5px 7px; border-radius: 8px; line-height: 1;
}
.pw-wrap .pw-eye:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
:root[data-theme="light"] .pw-wrap .pw-eye:hover { background: rgba(15, 23, 42, .07); }
