/* Crew PVE — thème sombre chaud, vert du serveur Time PVP utilisé par touches */

:root {
  --bg: #12100d;
  --bg-2: #181511;
  --surface: #1f1b16;
  --surface-2: #2b251c;          /* brun du serveur */
  --border: #3a3229;
  --border-strong: #4d4336;
  --text: #eee9e2;
  --muted: #a69d90;
  --faint: #7a7166;
  --accent: #4ef460;             /* vert du serveur */
  --accent-ink: #0b1a0d;
  --accent-soft: rgba(78, 244, 96, 0.1);
  --accent-line: rgba(78, 244, 96, 0.35);
  --blue: #7cb7ff;
  --amber: #f2c14e;
  --red: #ff6b5b;
  --discord: #5865f2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(78, 244, 96, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img { max-width: 100%; }
a { color: var(--text); text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); }
h2 { font-size: 1.15rem; margin-top: 1.6em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.8em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.accent { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- En-tête ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(18, 16, 13, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.02rem; letter-spacing: 0.04em; text-transform: uppercase; }
.brand-text small { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.mainnav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.mainnav a, .crewbar a { padding: 7px 11px; border-radius: var(--radius-sm); text-decoration: none; color: var(--muted); white-space: nowrap; font-weight: 500; }
.mainnav a:hover, .crewbar a:hover { color: var(--text); background: var(--surface); }
.mainnav a.active, .crewbar a.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.account { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.account form { margin: 0; }
.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip img { border-radius: 50%; }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 0.75rem; font-weight: 700; text-align: center; line-height: 20px; }
.count-soft { color: var(--faint); font-size: 0.8rem; margin-left: 2px; }

.crewbar { border-top: 1px solid var(--border); background: var(--bg-2); }
.crewbar-inner { max-width: 1180px; margin: 0 auto; padding: 6px 16px; display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.crewbar a { padding: 5px 10px; font-size: 0.9rem; }
.crewbar-label { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin-right: 4px; }
.crewbar-sep { width: 1px; height: 18px; background: var(--border); margin: 0 10px; }

.role { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--muted); }
.role-admin { border-color: var(--accent-line); color: var(--accent); }
.role-membre { border-color: var(--border-strong); color: var(--text); }
.role-banni { border-color: rgba(255, 107, 91, 0.4); color: var(--red); }

/* ---------- Mise en page ---------- */
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 16px 48px; flex: 1; }
.footer { max-width: 1180px; width: 100%; margin: 0 auto; padding: 18px 16px 28px; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--border); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 0.4em; }
.page-head h1 { margin: 0; }
.stack { display: grid; gap: 14px; }
.two-cols { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
.two-cols > section > h2:first-child { margin-top: 0.4em; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h2:first-child { margin-top: 0; }
.empty { text-align: center; padding: 36px 18px; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 60ch; }

.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 18px; border: 1px solid var(--accent-line); background: var(--accent-soft); }
.flash-error { border-color: rgba(255, 107, 91, 0.45); background: rgba(255, 107, 91, 0.1); }
.message-box { max-width: 560px; margin: 40px auto; text-align: center; }

/* ---------- Boutons & formulaires ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #6ff77e; border-color: #6ff77e; color: var(--accent-ink); }
.btn-ghost { background: transparent; }
/* Vert en contour : pour les actions répétées (le plein est réservé à l'action principale de la page) */
.btn-accent { background: transparent; border-color: var(--accent-line); color: var(--accent); }
.btn-accent:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; border-color: rgba(255, 107, 91, 0.5); color: var(--red); }
.btn-danger:hover { background: rgba(255, 107, 91, 0.12); color: var(--red); border-color: var(--red); }
.btn-discord { background: var(--discord); border-color: var(--discord); color: #fff; }
.btn-discord:hover { background: #6d78f5; border-color: #6d78f5; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 0.87rem; }
.btn-block { width: 100%; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea { width: 100%; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
input[type="file"] { padding: 7px; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form { max-width: 720px; }
.form label:first-of-type { margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.actions form { margin: 0; }
fieldset.prices { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 18px 0 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
fieldset.prices legend { font-weight: 600; padding: 0 6px; }
fieldset.prices label { margin: 0; font-weight: 500; }
fieldset.prices input { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.inline-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select { width: auto; padding: 6px 8px; }

/* ---------- Prix ---------- */
.price { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; white-space: nowrap; }
.price-lg { font-size: 1.15rem; }
.price-muted { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }

/* ---------- Catalogue ---------- */
.hero { display: grid; gap: 24px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: center; margin-bottom: 28px; }
.hero h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem); }
.hero-steps { display: grid; gap: 10px; }
.hero-steps div { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--accent-line); color: var(--accent); font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input[type="search"] { flex: 1; min-width: 200px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.card.item { display: flex; flex-direction: column; padding: 0; overflow: hidden; transition: border-color 0.15s, transform 0.15s; }
.item:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.item-img { aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--surface-2), var(--bg-2)); display: grid; place-items: center; border-bottom: 1px solid var(--border); }
.item-img img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.item-initials { font-size: 2.4rem; font-weight: 800; color: var(--border-strong); letter-spacing: 0.04em; }
.item-body { padding: 14px 16px 6px; flex: 1; }
.item-name { font-size: 1.05rem; margin: 0 0 4px; }
.item-desc { color: var(--muted); font-size: 0.88rem; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.item-price { margin: 6px 0 0; }
.add-to-cart { display: flex; gap: 8px; padding: 10px 16px 16px; margin: 0; }
.add-to-cart input { width: 76px; flex-shrink: 0; text-align: center; }
.add-to-cart button { flex: 1; }
.add-to-cart.added button { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.item-crew { margin: -4px 16px 14px; color: var(--muted); }
.empty-search { text-align: center; padding: 24px; }

/* ---------- Panier & commandes ---------- */
.cart-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.checkout { position: sticky; top: 130px; }
.checkout h2 { margin-top: 0; }
.lines { width: 100%; border-collapse: collapse; }
.lines th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 600; padding: 0 8px 8px; }
.lines td { padding: 8px; border-top: 1px solid var(--border); vertical-align: middle; }
.lines tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); padding-top: 12px; }
.lines .qty { color: var(--muted); white-space: nowrap; width: 1%; }
.num { text-align: right; }
.cart-table input { width: 84px; text-align: center; padding: 6px; }
.icon-btn { background: none; border: 0; color: var(--faint); font-size: 1.2rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { color: var(--red); background: rgba(255, 107, 91, 0.1); }

.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.order-head h3 { margin: 0; }
.order-head p { margin: 2px 0 0; }
.order-player { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--bg-2); border-radius: var(--radius-sm); margin-bottom: 10px; }
.order-player img { border-radius: 50%; }
.note { margin: 12px 0 0; padding: 8px 12px; border-left: 3px solid var(--border-strong); color: var(--muted); font-style: italic; }
.order-meta { margin: 10px 0 0; }
.cancel-box { display: inline-block; }
.cancel-box summary { list-style: none; }
.cancel-box summary::-webkit-details-marker { display: none; }
.cancel-box[open] form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; width: 100%; }
.cancel-box[open] input { flex: 1; min-width: 200px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; border: 1px solid; }
.pill-nouvelle { color: var(--blue); border-color: rgba(124, 183, 255, 0.4); background: rgba(124, 183, 255, 0.08); }
.pill-acceptee { color: var(--amber); border-color: rgba(242, 193, 78, 0.4); background: rgba(242, 193, 78, 0.08); }
.pill-livree { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.pill-annulee { color: var(--muted); border-color: var(--border-strong); background: transparent; }

/* ---------- Convertisseur ---------- */
.converter { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 18px; align-items: center; }
.conv-side label { margin-top: 0; }
.conv-row { display: flex; gap: 8px; }
.conv-row input { width: 110px; flex-shrink: 0; }
.conv-side p { margin: 8px 0 0; }
.conv-swap { font-size: 1.2rem; padding: 8px 14px; }
.conv-result { margin-top: 16px; text-align: center; }
.conv-big { font-size: clamp(1.3rem, 1rem + 1.5vw, 2rem); font-weight: 700; margin: 6px 0; }

/* ---------- Crew ---------- */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin: 10px 0 8px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); }
a.tile:hover { border-color: var(--border-strong); color: var(--text); }
.tile-num { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-label { color: var(--muted); font-size: 0.9rem; }
.tile-hot { border-color: var(--accent-line); }
.tile-hot .tile-num { color: var(--accent); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 6px 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

.vote-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.vote-head h3 { margin: 4px 0 2px; }
.vote-head p { margin: 0; }
.vote-thumb { width: 64px; height: 64px; object-fit: contain; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); flex-shrink: 0; }
.vote-pending { border-color: rgba(242, 193, 78, 0.4); }
.tag { display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 8px; }
.options { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.option { display: grid; grid-template-columns: 170px minmax(60px, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: center; }
.vote-pending .option { grid-template-columns: 120px minmax(60px, 1fr) auto auto; }
.option form { margin: 0; }
.vote-btn { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--muted); font: inherit; cursor: pointer; }
.vote-btn:hover { border-color: var(--accent-line); }
.option-mine .vote-btn { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.voters { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
progress.bar { width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--bg-2); overflow: hidden; -webkit-appearance: none; appearance: none; }
progress.bar::-webkit-progress-bar { background: var(--bg-2); border-radius: 999px; }
progress.bar::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress.bar::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.admin-box { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 10px; }
.admin-box summary { cursor: pointer; color: var(--muted); }
.admin-box .actions { margin-top: 10px; }

/* ---------- Tableaux ---------- */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.row-dim td { opacity: 0.55; }
.who { display: inline-flex; align-items: center; gap: 8px; }
.who img { border-radius: 50%; flex-shrink: 0; }
.thumb-cell { width: 56px; }
.thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: var(--bg-2); display: block; }
.thumb-lg { max-width: 160px; max-height: 120px; object-fit: contain; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); display: block; margin-bottom: 8px; padding: 6px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.history li { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.history li:last-child { border-bottom: 0; padding-bottom: 0; }
.danger-zone { margin-top: 20px; border-color: rgba(255, 107, 91, 0.3); }

/* ---------- Petits écrans ---------- */
@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .mainnav { order: 3; flex-basis: 100%; }
  .account { margin-left: auto; }
  .hero { grid-template-columns: 1fr; }
  .cart-layout { grid-template-columns: 1fr; }
  .checkout { position: static; }
}
@media (max-width: 640px) {
  .user-name, .user-chip .role { display: none; }
  .converter { grid-template-columns: 1fr; }
  .conv-swap { justify-self: center; transform: rotate(90deg); }
  .option, .vote-pending .option { grid-template-columns: 1fr; gap: 6px; }
  .cart-table th:nth-child(2), .cart-table td:nth-child(2) { display: none; }
  .card { padding: 14px; }
  .item-img { aspect-ratio: 16 / 7; }
  .item-initials { font-size: 1.8rem; }
  .table-wrap.card { padding: 0; }
}
