/* ============================================================
   css/global.css — Styles partagés Jamooral
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500&display=swap');

/* ── Variables ────────────────────────────────────────────── */
:root {
  --lav:     #8b5cf6;
  --lav-l:   #ede9ff;
  --lav-ll:  #f5f3ff;
  --lav-d:   #6d28d9;
  --bg:      #f8f7f5;
  --bg2:     #ffffff;
  --bg3:     #f0eef8;
  --txt:     #111111;
  --txt2:    #555555;
  --txt3:    #888888;
  --brd:     #e5e3f0;
  --brd2:    #d0cce8;
  --ok:      #16a34a;
  --err:     #dc2626;
  --font-t:  'Playfair Display', serif;
  --font-b:  'DM Sans', sans-serif;
  --rad:     14px;
  --rad-sm:  8px;
  --shadow:  0 4px 20px rgba(139,92,246,.10);
}

[data-theme=dark] {
  --bg:    #0f0e14;
  --bg2:   #181620;
  --bg3:   #1e1b2e;
  --txt:   #f0eeff;
  --txt2:  #b0a8cc;
  --txt3:  #6b6485;
  --brd:   #2e2a40;
  --brd2:  #3d3858;
  --lav-l: #2d2650;
  --lav-ll:#231e3e;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  transition: background .3s, color .3s;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ── Navigation ───────────────────────────────────────────── */
nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--brd);
  padding: 0 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background .3s, border-color .3s;
}
.logo {
  font-family: var(--font-t);
  font-size: 1.5rem;
  color: var(--txt);
  font-weight: 700;
  cursor: pointer;
  transition: color .2s;
  user-select: none;
}
.logo:hover { color: var(--lav); }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  color: var(--txt2);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .2s;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover,
.nav-links a.active { color: var(--lav); border-bottom-color: var(--lav); }
.nav-right { display: flex; align-items: center; gap: 10px; }

/* Toggle thème */
.theme-toggle {
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: 20px;
  width: 40px; height: 22px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .3s;
}
.theme-toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--lav);
  transition: left .25s;
}
[data-theme=dark] .theme-toggle::after { left: 21px; }

/* Burger */
.burger {
  display: none;
  background: none;
  border: none;
  padding: 6px;
  color: var(--txt);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
}
.burger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--txt);
  border-radius: 2px;
  transition: transform .3s ease, opacity .3s ease, width .3s ease;
}
.burger.open .burger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open .burger-line:nth-child(2) { opacity: 0; width: 0; }
.burger.open .burger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu {
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border-bottom: 1px solid var(--brd);
  padding: 0 1.5rem;
  gap: 0;
  position: relative;
  z-index: 99;
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s cubic-bezier(.4,0,.2,1), padding .35s;
}
.mobile-menu.open { max-height: 400px; padding: 1rem 1.5rem; }
.mobile-menu a {
  color: var(--txt2);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 10px 0;
  border-bottom: 1px solid var(--brd);
  transition: color .2s;
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover,
.mobile-menu a.active { color: var(--lav); }

/* ── Boutons ──────────────────────────────────────────────── */
.btn-prim {
  background: var(--lav);
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: 24px;
  font-family: var(--font-b);
  font-size: .9rem;
  font-weight: 500;
  transition: background .2s, transform .15s;
  white-space: nowrap;
}
.btn-prim:hover { background: var(--lav-d); transform: translateY(-1px); }
.btn-prim:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-sec {
  background: transparent;
  color: var(--lav);
  border: 1.5px solid var(--lav);
  padding: 10px 22px;
  border-radius: 24px;
  font-family: var(--font-b);
  font-size: .9rem;
  font-weight: 500;
  transition: background .2s;
}
.btn-sec:hover { background: var(--lav-l); }

.btn-ghost {
  background: none;
  border: none;
  color: var(--txt3);
  font-family: var(--font-b);
  font-size: .85rem;
}
.btn-ghost:hover { color: var(--txt); }

.btn-admin-nav {
  background: var(--lav);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 20px;
  font-family: var(--font-b);
  font-size: .82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .2s;
  white-space: nowrap;
}
.btn-admin-nav:hover { background: var(--lav-d); }

/* ── Section / Layout ─────────────────────────────────────── */
.section { padding: 3.5rem 3rem; }
.sec-head { margin-bottom: 2rem; }
.sec-title { font-family: var(--font-t); font-size: 1.85rem; color: var(--txt); }
.accent { width: 40px; height: 3px; background: var(--lav); border-radius: 2px; margin: .5rem 0 .7rem; }
.sec-sub { color: var(--txt3); font-size: .9rem; }

/* ── Pages ────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; animation: fadeIn .28s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Cards produits ───────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
}
.pcard {
  background: var(--bg2);
  border-radius: var(--rad);
  border: 1px solid var(--brd);
  overflow: hidden;
  transition: transform .22s, border-color .22s, box-shadow .22s;
}
.pcard:hover {
  transform: translateY(-5px);
  border-color: var(--lav);
  box-shadow: var(--shadow);
}
.pcard-img {
  width: 100%; height: 155px;
  background: var(--lav-l);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.pcard-img img { width: 100%; height: 100%; object-fit: cover; }
.pcard-img .ph-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.pcard-img .ph-icon svg { width: 52px; height: 52px; stroke: var(--lav); fill: none; stroke-width: 1.4; }
.pcard-body { padding: .95rem 1.1rem 1.15rem; }
.pcard-cat { font-size: .72rem; color: var(--lav); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.pcard-name { font-family: var(--font-t); font-size: 1.05rem; color: var(--txt); margin-bottom: 4px; transition: color .2s; }
.pcard:hover .pcard-name { color: var(--lav); }
.pcard-desc { font-size: .8rem; color: var(--txt3); line-height: 1.5; margin-bottom: 8px; }
.pcard-price { font-weight: 600; color: var(--lav); font-size: .95rem; }

/* ── Formulaires ──────────────────────────────────────────── */
.fg { margin-bottom: .9rem; }
.fg label { display: block; font-size: .83rem; font-weight: 500; color: var(--txt2); margin-bottom: 4px; }
.fg input,
.fg select,
.fg textarea {
  width: 100%;
  border: 1.5px solid var(--brd);
  border-radius: var(--rad-sm);
  padding: 10px 13px;
  font-family: var(--font-b);
  font-size: .88rem;
  background: var(--bg2);
  color: var(--txt);
  outline: none;
  transition: border-color .2s;
}
.fg input:focus,
.fg select:focus,
.fg textarea:focus { border-color: var(--lav); }
.fg textarea { height: 100px; resize: vertical; }
.fg .hint { font-size: .75rem; color: var(--txt3); margin-top: 3px; }

/* ── Messages état ────────────────────────────────────────── */
.msg { font-size: .83rem; padding: 8px 12px; border-radius: var(--rad-sm); margin-top: 8px; display: none; }
.msg.ok  { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.msg.err { background: #fef2f2; color: var(--err); border: 1px solid #fecaca; }
[data-theme=dark] .msg.ok  { background: #14532d; color: #86efac; border-color: #166534; }
[data-theme=dark] .msg.err { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
.msg.show { display: block; }

/* ── Modals ───────────────────────────────────────────────── */
.modal-wrap {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-wrap.open { display: flex; }
.modal {
  background: var(--bg2);
  border-radius: 18px;
  padding: 2.2rem;
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--brd);
  animation: fadeIn .2s ease;
}
.modal h2 { font-family: var(--font-t); font-size: 1.4rem; color: var(--txt); margin-bottom: .25rem; }
.modal .modal-sub { color: var(--txt3); font-size: .85rem; margin-bottom: 1.4rem; }
.modal .btn-row { display: flex; justify-content: space-between; align-items: center; margin-top: 1.2rem; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 9px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-lav  { background: var(--lav-l);   color: var(--lav-d); }
.badge-ok   { background: #dcfce7; color: #15803d; }
.badge-warn { background: #fef9c3; color: #854d0e; }
.badge-err  { background: #fef2f2; color: var(--err); }
[data-theme=dark] .badge-ok   { background: #14532d; color: #86efac; }
[data-theme=dark] .badge-warn { background: #422006; color: #fde68a; }
[data-theme=dark] .badge-err  { background: #450a0a; color: #fca5a5; }

/* ── Table admin ──────────────────────────────────────────── */
.atable {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg2);
  border-radius: var(--rad);
  overflow: hidden;
  border: 1px solid var(--brd);
  font-size: .85rem;
  table-layout: fixed;
}
.atable th {
  background: var(--lav-l);
  color: var(--lav-d);
  font-size: .74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 9px 13px;
  text-align: left;
}
.atable td {
  padding: 9px 13px;
  color: var(--txt);
  border-top: 1px solid var(--brd);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.atable tr:hover td { background: var(--bg3); }

.btn-tbl {
  background: none;
  border: 1.5px solid var(--brd2);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: .75rem;
  font-family: var(--font-b);
  transition: all .2s;
}
.btn-tbl-edit { color: var(--lav); }
.btn-tbl-edit:hover { background: var(--lav-l); border-color: var(--lav); }
.btn-tbl-del  { color: var(--err); border-color: #fecaca; margin-left: 5px; }
.btn-tbl-del:hover  { background: #fef2f2; }

/* ── Panier ───────────────────────────────────────────────── */
.cart-fab {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  background: var(--lav);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-family: var(--font-b);
  font-size: .9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(139,92,246,.35);
  z-index: 90;
  transition: transform .2s, background .2s;
}
.cart-fab:hover { transform: translateY(-2px); background: var(--lav-d); }
.cart-fab.hidden { display: none; }
.cart-badge {
  background: #fff;
  color: var(--lav);
  border-radius: 50%;
  width: 20px; height: 20px;
  font-size: .75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  background: var(--bg2);
  border-top: 1px solid var(--brd);
  padding: 1.8rem 2.5rem;
  text-align: center;
  color: var(--txt3);
  font-size: .82rem;
  line-height: 1.7;
}
footer strong { color: var(--lav); font-family: var(--font-t); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  nav { padding: 0 1rem; }
  .nav-links { display: none !important; }
  .burger { display: flex; }
  .section { padding: 2rem 1.2rem; }
  .logo { font-size: .95rem; }
  .logo svg { width: 24px !important; height: 24px !important; }
  .logo > span > span:first-child { font-size: .5rem !important; letter-spacing: 1px !important; }
  .logo > span > span:last-child { font-size: .95rem; }
  .theme-switch-desktop { display: none !important; }
}
@media (max-width: 480px) {
  .hero h1 { font-size: 1.8rem; }
  .products-grid { grid-template-columns: 1fr; }
}
