/* =============================================================
   MEGAVOLTE - Feuille de style commune
   ============================================================= */
:root {
  --bg: #f5f7f9;           /* fond clair du site */
  --bg-soft: #eef1f4;
  --panel: #ffffff;
  --panel-2: #f3f5f8;
  --border: #e0e5ea;
  --text: #16232b;
  --muted: #61727d;
  --brand: #0a9fb3;        /* cyan MEGAVOLTE assombri pour contraste sur blanc */
  --brand-2: #077d8e;
  --sale: #b07d00;         /* ambre promo lisible sur blanc */
  --accent: #12a87a;
  --danger: #d64562;
  /* surfaces sombres conservées : bandeau + pied de page + sidebar admin */
  --dark: #00121f;
  --dark-2: #0a2131;
  --on-dark: #e8f1f5;
  --on-dark-muted: #93a7b3;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 24px rgba(20, 40, 55, .10);
  --maxw: 1180px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.row { display: flex; gap: 14px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------- boutons ------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: transform .05s ease, background .15s ease, border-color .15s ease, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); border-color: #c9d1d8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #ffffff;
  border-color: transparent;
}
.btn.primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--brand) 0%, var(--brand-2) 100%); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(0, 0, 0, .04); }
.btn.danger { border-color: rgba(214, 69, 98, .45); color: var(--danger); }
.btn.danger:hover { background: rgba(255, 84, 112, .12); }
.btn.sm { padding: 7px 12px; font-size: .85rem; }
.btn.block { width: 100%; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.brand { background: rgba(41, 197, 214, .14); color: var(--brand); border-color: rgba(41, 197, 214, .35); }
.badge.accent { background: rgba(46, 230, 166, .14); color: var(--accent); border-color: rgba(46, 230, 166, .3); }
.badge.danger { background: rgba(255, 84, 112, .14); color: #ff9fb0; border-color: rgba(255, 84, 112, .3); }
.badge.sale { background: rgba(245, 197, 24, .16); color: var(--sale); border-color: rgba(245, 197, 24, .4); }
.badge.condition { background: rgba(46, 230, 166, .12); color: var(--accent); border-color: rgba(46, 230, 166, .3); }

/* ---------- champs ------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.field .hint { font-size: .74rem; color: var(--muted); }
input[type=text], input[type=number], input[type=email], input[type=url], input[type=search], select, textarea {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(41, 197, 214, .22);
}
textarea { min-height: 90px; resize: vertical; }
.checkbox { flex-direction: row; align-items: center; gap: 10px; }
.checkbox input { width: 18px; height: 18px; }

/* ---------- header ------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--dark);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.site-header .btn.ghost { color: var(--on-dark); border-color: rgba(255, 255, 255, .16); }
.site-header .btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.site-header .container {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 132px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .5px;
  font-size: 1.15rem;
}
.logo img { height: 108px; width: auto; display: block; }
.logo .bolt {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #00121f;
}
.logo small { display: block; font-size: .62rem; font-weight: 600; color: var(--muted); letter-spacing: 2px; }

.nav { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--on-dark-muted);
  font-weight: 600;
  font-size: .92rem;
}
.nav a:hover, .nav a.active { color: var(--on-dark); background: rgba(255, 255, 255, .09); }

.cart-btn { position: relative; }
.cart-count {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 19px; height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: .7rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

/* ---------- hero ------------------------------------------------ */
.hero {
  position: relative;
  padding: 66px 0 44px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(700px 340px at 85% -20%, rgba(10, 159, 179, .12), transparent 70%),
    radial-gradient(500px 300px at 0% 120%, rgba(18, 168, 122, .10), transparent 70%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  margin: 0 0 14px;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 640px; }
.hero .cta { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero .kicker {
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--brand);
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* ---------- barre de filtres ------------------------------------------------ */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0 26px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.toolbar .search { flex: 1; min-width: 200px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--brand); color: #171200; border-color: transparent; }

/* ---------- grille produits ------------------------------------------------ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .12s ease, border-color .12s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow); }
.card .thumb {
  aspect-ratio: 4 / 3;
  background: var(--panel-2);
  position: relative;
  overflow: hidden;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .tag-promo {
  position: absolute;
  top: 10px; left: 10px;
}
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .body h3 { margin: 0; font-size: 1rem; }
.card .cat { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.card .price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.card .price { font-size: 1.15rem; font-weight: 800; }
.card .strike { color: var(--muted); text-decoration: line-through; font-size: .9rem; }
.card .btn { margin-top: 10px; }

/* ---------- fiche produit (modale) ------------------------------------------------ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, .72);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow: auto;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 900px;
  width: 100%;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal .modal-body { padding: 20px; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.product-detail .gallery img {
  border-radius: var(--radius-sm);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  background: var(--panel-2);
}
.product-detail h2 { margin: 4px 0 8px; }
.product-detail .price { font-size: 1.6rem; font-weight: 800; margin: 12px 0; }
.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.qty button { background: var(--panel-2); border: none; padding: 8px 12px; cursor: pointer; }
.qty button:hover { background: var(--bg-soft); }
.qty input { width: 52px; text-align: center; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-radius: 0; }

/* ---------- panier / tiroir ------------------------------------------------ */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  z-index: 120;
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer .drawer-head {
  padding: 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer .drawer-body { flex: 1; overflow: auto; padding: 12px 18px; }
.drawer .drawer-foot { padding: 18px; border-top: 1px solid var(--border); }

.cart-line { display: grid; grid-template-columns: 62px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-line img { width: 62px; height: 62px; object-fit: cover; border-radius: 8px; background: var(--panel-2); }
.cart-line .name { font-weight: 600; font-size: .92rem; }
.cart-line .meta { color: var(--muted); font-size: .8rem; }
.cart-line .rm { background: none; border: none; color: var(--danger); cursor: pointer; font-size: .8rem; padding: 0; }
.cart-line .pay-line { font-size: .8rem; font-weight: 600; color: var(--brand); }
.cart-line .pay-line.off { color: var(--muted); font-weight: 400; }

.summary-line { display: flex; justify-content: space-between; margin: 6px 0; color: var(--muted); }
.summary-line.total { color: var(--text); font-weight: 800; font-size: 1.15rem; margin-top: 12px; }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- sections info ------------------------------------------------ */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 50px 0;
}
.feature {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.feature .ico { font-size: 1.5rem; }
.feature h4 { margin: 8px 0 4px; }
.feature p { margin: 0; color: var(--muted); font-size: .9rem; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .big { font-size: 2.4rem; margin-bottom: 8px; }

/* ---------- footer ------------------------------------------------ */
.site-footer {
  background: var(--dark);
  margin-top: 60px;
  padding: 30px 0;
  color: var(--on-dark-muted);
  font-size: .88rem;
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.site-footer a { color: var(--on-dark-muted); }
.site-footer a:hover { color: var(--on-dark); }

/* ---------- toast ------------------------------------------------ */
.toast-wrap {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* =============================================================
   ADMIN
   ============================================================= */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-side {
  background: var(--dark);
  border-right: 1px solid rgba(255, 255, 255, .07);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.admin-side .logo { margin-bottom: 24px; }
.admin-side .btn.ghost { color: var(--on-dark); border-color: rgba(255, 255, 255, .16); }
.admin-side .btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav button {
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--on-dark-muted);
  cursor: pointer;
  font-weight: 600;
}
.admin-nav button:hover { color: var(--on-dark); background: rgba(255, 255, 255, .07); }
.admin-nav button.active { color: var(--on-dark); background: rgba(41, 197, 214, .22); }

.admin-main { padding: 26px 30px; overflow: auto; }
.admin-main h1 { margin: 0 0 4px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat .k { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; }
.stat .v { font-size: 1.6rem; font-weight: 800; margin-top: 4px; }
.stat .v.pos { color: var(--accent); }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
}

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
table.data th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: 1px; }
table.data tbody tr:hover { background: rgba(10, 159, 179, .06); }
table.data td .mini-thumb { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; background: var(--panel-2); }
table.data .actions { display: flex; gap: 6px; justify-content: flex-end; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }

.pill-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.pill-toggle button { background: transparent; border: none; padding: 7px 14px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .85rem; }
.pill-toggle button.active { background: var(--brand-2); color: #fff; }

.margin-preview {
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.margin-preview b { color: var(--text); }
.margin-preview .pos { color: var(--accent); }
.margin-preview .neg { color: var(--danger); }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}
.dropzone.drag { border-color: var(--brand); background: rgba(41, 197, 214, .08); }

/* =============================================================
   PAGES LEGALES / INFORMATIONS
   ============================================================= */
.legal { padding: 40px 0 20px; }
.legal .container { max-width: 860px; }
.legal .breadcrumb { font-size: .82rem; color: var(--muted); margin-bottom: 18px; }
.legal .breadcrumb a { color: var(--muted); }
.legal .breadcrumb a:hover { color: var(--text); }
.legal h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0 0 6px; }
.legal .updated { color: var(--muted); font-size: .85rem; margin-bottom: 30px; }
.legal .doc {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
}
.legal .doc h2 {
  font-size: 1.15rem;
  margin: 34px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.legal .doc h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.legal .doc h3 { font-size: 1rem; margin: 20px 0 8px; color: var(--brand-2); }
.legal .doc p, .legal .doc li { color: #33424c; }
.legal .doc ul, .legal .doc ol { padding-left: 22px; }
.legal .doc li { margin: 5px 0; }
.legal .doc a { color: var(--brand); text-decoration: underline; }
.legal .doc strong { color: var(--text); }
.legal .doc table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .9rem; }
.legal .doc th, .legal .doc td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.legal .doc th { background: var(--panel-2); color: var(--muted); }
.legal .todo {
  background: rgba(176, 125, 0, .12);
  border: 1px solid rgba(176, 125, 0, .4);
  color: #7a5b00;
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 600;
  font-size: .92em;
}
.legal .callout {
  background: var(--bg-soft);
  border-left: 3px solid var(--brand-2);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 16px 0;
}
.legal .callout.warn { border-left-color: var(--danger); }
.legal .toc {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 22px;
}
.legal .toc ol { margin: 8px 0 0; padding-left: 20px; columns: 2; }
.legal .toc a { color: #33424c; text-decoration: none; }
.legal .toc a:hover { color: var(--brand); }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* ---------- responsive ------------------------------------------------ */
@media (max-width: 860px) {
  .product-detail { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .nav a span.label { display: none; }
  .legal .doc { padding: 20px 18px; }
  .legal .toc ol { columns: 1; }
  .site-header .container { min-height: 0; flex-wrap: wrap; gap: 10px; }
  .logo img { height: 66px; }
}
@media (max-width: 520px) {
  .logo img { height: 52px; }
}
