/* ============================================================
   Thème sombre — structure d'app mode type Shein, sur mobile d'abord.
   - Typo display : Space Grotesk / corps : system-ui (vitesse 3G)
   - Photos produit portrait 3:4, grille dense
   - Barre d'onglets fixe en bas (Accueil / Promos / Panier) comme une app
   - Le vert WhatsApp (#25D366) reste RÉSERVÉ aux actions de commande
   - --primaire / --secondaire injectées depuis les paramètres boutique
   ============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&display=swap");

:root {
  --primaire: #ffffff;      /* surchargée par les paramètres boutique */
  --secondaire: #f5a623;
  --wa: #25d366;
  --wa-fonce: #1daa54;
  --fond: #0e0d11;          /* noir profond légèrement violacé */
  --carte: #19181d;
  --carte-haute: #211f26;
  --ligne: #2b2932;
  --texte: #f2f0ed;
  --doux: #9b97a0;
  --rayon: 14px;
  --ombre: 0 1px 3px rgba(0, 0, 0, 0.4);
  --ombre-haute: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
  --display: "Space Grotesk", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* place pour la barre d'onglets fixe sur mobile */
  padding-bottom: 76px;
}
@media (min-width: 800px) { body { padding-bottom: 0; } }
body.admin { padding-bottom: 0; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; }

/* ===== En-tête ===== */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(14, 13, 17, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ligne);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.logo img { height: 34px; width: 34px; object-fit: contain; border-radius: 9px; }

.lien-panier {
  position: relative;
  font-size: 1.3rem;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ligne);
  border-radius: 50%;
  background: var(--carte);
}
.badge-panier {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--wa);
  color: #06130b;
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--fond);
}

/* ===== Nav catégories (vitrine : défile ; admin : passe à la ligne) ===== */
nav.categories {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.7rem 1rem;
}
nav.categories::-webkit-scrollbar { display: none; }
nav.categories a {
  white-space: nowrap;
  padding: 0.4rem 1rem;
  border: 1px solid var(--ligne);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--carte);
  color: var(--texte);
  transition: border-color 0.15s;
}
nav.categories a:hover { border-color: var(--doux); }
nav.categories a.active {
  background: var(--texte);
  color: var(--fond);
  border-color: var(--texte);
  font-weight: 700;
}
/* Console admin : tous les onglets visibles, quelle que soit la largeur */
#nav-admin nav.categories {
  flex-wrap: wrap;
  overflow: visible;
  border-bottom: 1px solid var(--ligne);
  background: var(--carte);
}

main { padding: 1rem; max-width: 1100px; margin: 0 auto; }

/* ===== Héro (accueil) ===== */
.hero { padding: 1.4rem 0.2rem 1.1rem; }
.hero h1 {
  font-size: clamp(1.7rem, 6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.hero p { color: var(--doux); margin-top: 0.4rem; font-size: 0.98rem; }
.hero p strong { color: var(--wa); font-weight: 600; }

/* ===== Recherche ===== */
.recherche input {
  width: 100%;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--ligne);
  border-radius: 999px;
  font-size: 1rem;
  margin-bottom: 1.1rem;
  background: var(--carte);
  color: var(--texte);
}
.recherche input::placeholder { color: var(--doux); }
.recherche input:focus { outline: 2px solid var(--wa); outline-offset: 1px; }

/* ===== Grille produits (dense, type Shein) ===== */
.grille-produits {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  animation: apparition 0.35s ease-out;
}
@media (min-width: 640px) { .grille-produits { grid-template-columns: repeat(3, 1fr); gap: 0.8rem; } }
@media (min-width: 960px) { .grille-produits { grid-template-columns: repeat(4, 1fr); } }

@keyframes apparition {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .grille-produits { animation: none; }
  * { transition: none !important; }
}

.carte-produit {
  background: var(--carte);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  overflow: hidden;
  box-shadow: var(--ombre);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  display: block;
}
@media (hover: hover) {
  .carte-produit:hover {
    transform: translateY(-3px);
    box-shadow: var(--ombre-haute);
    border-color: var(--doux);
  }
}
.carte-produit .photo {
  aspect-ratio: 3 / 4;
  object-fit: cover;
  width: 100%;
  background: linear-gradient(160deg, var(--carte-haute), var(--ligne));
}
.carte-produit .infos { padding: 0.6rem 0.7rem 0.8rem; }
.carte-produit .nom {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--doux);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.6em;
}

.prix {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  margin-top: 0.3rem;
  letter-spacing: -0.01em;
  color: var(--texte);
}
.prix .ancien {
  color: var(--doux);
  text-decoration: line-through;
  font-weight: 500;
  font-size: 0.82rem;
  margin-left: 0.4rem;
}
.badge-promo {
  display: inline-block;
  background: var(--secondaire);
  color: #1a1205;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.14rem 0.55rem;
  border-radius: 4px;          /* rectangulaire, code visuel promo type Shein */
  margin-top: 0.35rem;
}
.indisponible { opacity: 0.5; }
.indisponible .photo { filter: grayscale(1); }

/* ===== Fiche produit ===== */
.fiche { display: grid; gap: 1.2rem; }
@media (min-width: 800px) { .fiche { grid-template-columns: 1fr 1fr; align-items: start; gap: 2rem; } }
.fiche h1 { font-size: 1.5rem; line-height: 1.15; }
.fiche .photo-principale {
  border-radius: var(--rayon);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  width: 100%;
  background: var(--carte-haute);
}
.miniatures { display: flex; gap: 0.5rem; margin-top: 0.6rem; overflow-x: auto; }
.miniatures img {
  width: 62px; height: 78px; object-fit: cover;
  border-radius: 10px; border: 2px solid transparent; cursor: pointer;
  flex-shrink: 0;
  opacity: 0.7;
}
.miniatures img.active { border-color: var(--wa); opacity: 1; }

.choix { margin: 0.9rem 0; }
.choix .etiquette { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.45rem; }
.pastilles { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.pastilles button {
  padding: 0.4rem 1rem;
  border: 1px solid var(--ligne);
  border-radius: 999px;
  background: var(--carte);
  color: var(--texte);
  transition: border-color 0.15s;
}
.pastilles button:hover { border-color: var(--doux); }
.pastilles button.actif {
  background: var(--texte);
  color: var(--fond);
  border-color: var(--texte);
  font-weight: 700;
}

/* ===== Boutons ===== */
.btn {
  display: block;
  width: 100%;
  padding: 0.95rem;
  border: none;
  border-radius: 12px;
  background: var(--texte);
  color: var(--fond);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  transition: filter 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.99); }
.btn:hover { filter: brightness(0.92); }
.btn.secondaire { background: var(--secondaire); color: #1a1205; }
/* Le vert WhatsApp : uniquement pour conclure la commande */
.btn.whatsapp { background: var(--wa); color: #06130b; }
.btn.whatsapp:hover { background: var(--wa-fonce); filter: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== Panier ===== */
.ligne-panier {
  display: flex;
  gap: 0.75rem;
  background: var(--carte);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  padding: 0.65rem;
  margin-bottom: 0.65rem;
  align-items: center;
}
.ligne-panier img { width: 64px; height: 80px; object-fit: cover; border-radius: 10px; background: var(--carte-haute); }
.ligne-panier .details { flex: 1; font-size: 0.9rem; }
.quantite { display: flex; align-items: center; gap: 0.55rem; margin-top: 0.35rem; }
.quantite button {
  width: 30px; height: 30px;
  border: 1px solid var(--ligne);
  border-radius: 8px;
  background: var(--carte-haute);
  color: var(--texte);
  font-weight: 700;
}
.retirer { background: none; border: none; color: var(--doux); font-size: 1.1rem; padding: 0.4rem; }

/* Récap : bulle de conversation — la commande EST une conversation WhatsApp */
.recap {
  position: relative;
  background: #10291a;
  border: 1px solid #1e4a2e;
  border-radius: 18px 18px 18px 4px;
  padding: 1rem 1.1rem;
  margin: 1.2rem 0;
}
.recap .ligne { display: flex; justify-content: space-between; padding: 0.22rem 0; font-size: 0.95rem; }
.recap .total {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  border-top: 1px solid #1e4a2e;
  margin-top: 0.5rem;
  padding-top: 0.55rem;
  color: var(--wa);
}

/* ===== Formulaires ===== */
form .champ { margin-bottom: 0.95rem; }
form label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }
form input, form textarea, form select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--ligne);
  border-radius: 11px;
  font-size: 1rem;
  background: var(--carte);
  color: var(--texte);
  font-family: inherit;
  color-scheme: dark;
}
form input::placeholder, form textarea::placeholder { color: var(--doux); }
form input:focus, form textarea:focus, form select:focus {
  outline: 2px solid var(--wa);
  outline-offset: 1px;
}

.message-vide { text-align: center; color: var(--doux); padding: 3.5rem 1rem; }
.erreur { color: #ff6b5e; font-size: 0.9rem; margin-top: 0.5rem; }

footer {
  text-align: center;
  color: var(--doux);
  font-size: 0.85rem;
  padding: 2.5rem 1rem;
}

/* ===== Barre d'onglets fixe en bas (vitrine mobile, comme une app) ===== */
.barre-onglets {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  background: rgba(14, 13, 17, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--ligne);
  padding: 0.45rem 0 calc(0.45rem + env(safe-area-inset-bottom));
}
@media (min-width: 800px) { .barre-onglets { display: none; } }
.barre-onglets a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  font-size: 0.72rem;
  color: var(--doux);
  position: relative;
}
.barre-onglets a .ic { font-size: 1.25rem; line-height: 1.2; }
.barre-onglets a.active { color: var(--texte); font-weight: 600; }
.barre-onglets .badge-panier {
  top: -2px;
  right: calc(50% - 22px);
}

/* ===== Console admin : mêmes fondations, blocs neutres ===== */
body.admin .recap {
  background: var(--carte);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
}
body.admin .recap .total { border-top-color: var(--ligne); color: var(--texte); }
body.admin main { max-width: 760px; }
body.admin #liste .ligne-panier button {
  background: var(--carte-haute);
  border: 1px solid var(--ligne);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
}
