/* Baraka — Boutique (cohérent avec index.html) */
:root {
  --bg: #000;
  --surface: #1a1a1a;
  --surface-elevated: #252525;
  --text: #fff;
  --text-muted: #ccc;
  --accent: #4caf50;
  --accent-hover: #43a047;
  --border: #333;
  --danger: #e57373;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --max-width: 1200px;
  --header-h: 80px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.shop-page {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  text-align: left;
  min-height: 100vh;
  line-height: 1.45;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ——— Header (aligné index) ——— */
.header-logo {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo img {
  height: 42px;
  width: auto;
  max-width: 100%;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  justify-content: center;
}

.header-title {
  font-size: clamp(1rem, 3.5vw, 1.75rem);
  font-weight: bold;
  margin: 0;
  color: var(--text);
  text-align: center;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-nav a,
.header-nav label {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.header-nav a:hover,
.header-nav label:hover {
  color: var(--accent);
  background: rgba(76, 175, 80, 0.08);
}

.header-cart-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 16px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.header-cart-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.header-cart-btn .cart-count {
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
}

.btn-identify {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-identify:hover {
  background: var(--accent-hover);
}

/* ——— Layout boutique ——— */
.shop-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px 120px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

@media (min-width: 960px) {
  .shop-layout {
    grid-template-columns: 1fr 360px;
    align-items: start;
    padding-bottom: 48px;
  }
}

.shop-main-title {
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0 0 8px;
  font-weight: bold;
}

.shop-subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: #fff;
  margin: 0 0 16px;
}

.cart-toggle-mobile {
  display: none;
}

.shop-intro {
  text-align: center;
  color: var(--text-muted);
  margin: 0 0 24px;
  font-size: 15px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.shop-cart-promos-hint {
  text-align: center;
  font-size: 13px;
  color: var(--accent);
  margin: -12px auto 20px;
  padding: 10px 14px;
  border: 1px solid rgba(76, 175, 80, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(76, 175, 80, 0.08);
  max-width: 640px;
}

/* Filtres catégories (prêt pour JS / Firestore) */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.category-filters button {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.category-filters button:hover,
.category-filters button.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(76, 175, 80, 0.12);
}

/* ——— Grille produits ———
   Schéma Firestore par carte : id, nome, prezzo, ingredienti[], categoria, disponibile, immagine_url
*/
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.product-card:hover {
  border-color: #444;
  box-shadow: var(--shadow);
}

.product-card.is-unavailable {
  opacity: 0.65;
}

.product-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-elevated);
  overflow: hidden;
}

.product-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card__badge-cat {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--accent);
  font-weight: 600;
}

.product-card__badge-stock {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.product-card__badge-stock--ok {
  background: rgba(76, 175, 80, 0.25);
  color: #a5d6a7;
}

.product-card__badge-stock--no {
  background: rgba(229, 115, 115, 0.25);
  color: var(--danger);
}

.product-card__body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-card__name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text);
}

.product-card__ingredients {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}

.product-card__meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.product-card__price-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.product-card__promo-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: rgba(76, 175, 80, 0.12);
}

.product-card__price {
  margin: 0;
  font-size: 1.15rem;
  font-weight: bold;
  color: var(--accent);
}

.product-card__price--strike {
  text-decoration: line-through;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.product-card__price--strike small {
  color: var(--text-muted);
}

.product-card__price--promo {
  color: var(--accent);
  font-size: 1.2rem;
}

.product-card__price small {
  font-size: 0.75rem;
  font-weight: normal;
  color: var(--text-muted);
}

.product-card__price--promo small {
  color: var(--text-muted);
}

.btn-add-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-add-cart:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-add-cart:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
}

/* ——— Panier (colonne / drawer mobile) ——— */
.cart-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  scroll-margin-top: calc(var(--header-h) + 12px);
}

@media (min-width: 960px) {
  .cart-panel {
    position: sticky;
    top: calc(var(--header-h) + 16px);
  }
}

@media (max-width: 959px) {
  .cart-toggle-mobile {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto 16px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
  }
  .cart-toggle-mobile .cart-count {
    min-width: 22px;
    height: 22px;
    font-size: 11px;
  }
  .cart-panel {
    display: none;
  }
  .cart-panel.is-open {
    display: block;
  }
}



.cart-panel__head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-panel__head h2 {
  margin: 0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: bold;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
}

.cart-panel__body {
  padding: 12px 16px 16px;
  max-height: min(420px, 50vh);
  overflow-y: auto;
}

@media (min-width: 960px) {
  .cart-panel__body {
    max-height: min(480px, calc(100vh - 280px));
  }
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px 12px;
  margin: 0;
}

.cart-panel:not(.has-items) .cart-lines {
  display: none;
}

.cart-panel:not(.has-items) .cart-empty {
  display: block;
}

.cart-panel.has-items .cart-empty {
  display: none;
}

.cart-line {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.cart-line:last-of-type {
  border-bottom: none;
}

.cart-line__thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-elevated);
  flex-shrink: 0;
}

.cart-line__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-line__info {
  min-width: 0;
}

.cart-line__title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.cart-line__unit {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.cart-line__controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.cart-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.cart-qty button {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.cart-qty button:hover {
  background: #333;
}

.cart-qty input[type="number"] {
  width: 40px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  
  /* Rimuove le freccette standard nei vari browser */
  -moz-appearance: textfield;      /* Per Firefox */
  -webkit-appearance: none;     /* Per Safari e Chrome (il warning nasce da qui) */
  appearance: none;             /* La proprietà standard (quella che corregge il warning) */
}

.cart-qty input::-webkit-outer-spin-button,
.cart-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-line__line-total {
  font-size: 14px;
  font-weight: bold;
  color: var(--accent);
}

.btn-remove-line {
  padding: 4px 8px;
  font-size: 12px;
  border: none;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}

.btn-remove-line:hover {
  color: #ffcdd2;
}

/* Totaux panier */
.cart-totals {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-elevated);
}

.cart-totals__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  margin-bottom: 10px;
  gap: 12px;
}

.cart-totals__row--stack {
  flex-direction: column;
  align-items: stretch;
}

.is-hidden {
  display: none;
}

.checkout-options {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.checkout-options label {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.checkout-input,
.checkout-select {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.checkout-input:focus,
.checkout-select:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-geoloc {
  margin-top: 8px;
  border: 1px solid var(--border);
  background: #2d2d2d;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
}

.btn-geoloc:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.geoloc-status {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.shop-empty {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.cart-totals__row:last-child {
  margin-bottom: 0;
}

.cart-totals__row--emphasis {
  font-size: 1.1rem;
  font-weight: bold;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}

.cart-totals__row--emphasis span:last-child {
  color: var(--accent);
}

.cart-totals__hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.btn-checkout {
  width: 100%;
  margin-top: 16px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s;
}

.btn-checkout:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-checkout:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ——— Modale inscription (CSS pur : checkbox) ——— */
.modal-state {
  position: fixed;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.modal-registration {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s;
}

#modal-registration-toggle:checked ~ .modal-registration {
  visibility: visible;
  opacity: 1;
}

.modal-registration__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
}

.modal-registration__dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px 22px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.modal-registration__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}

.modal-registration__close:hover {
  background: #333;
  color: var(--accent);
}

.modal-registration__title {
  margin: 0 32px 8px 0;
  font-size: 1.25rem;
  font-weight: bold;
}

.modal-registration__subtitle {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--text-muted);
}

.registration-form .field {
  margin-bottom: 16px;
}

.registration-form label.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.registration-form input[type="text"],
.registration-form input[type="tel"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.registration-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.25);
}

.registration-form .field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.modal-registration__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.btn-modal-primary {
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
}

.btn-modal-primary:hover {
  background: var(--accent-hover);
}

.btn-modal-ghost {
  padding: 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}

.btn-modal-ghost:hover {
  color: var(--text);
  border-color: #555;
}

/* ——— Popup "Inscrivez-vous" (CSS pur : checkbox) ——— */
.modal-prompt {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s;
}

#modal-prompt-toggle:checked ~ .modal-prompt {
  visibility: visible;
  opacity: 1;
}

.modal-prompt__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
}

.modal-prompt__dialog {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 24px 24px;
  text-align: center;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.modal-prompt__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}

.modal-prompt__close:hover {
  background: #333;
  color: var(--accent);
}

.modal-prompt__icon {
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}

.modal-prompt__title {
  margin: 0 0 8px;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--text);
}

.modal-prompt__text {
  margin: 0 0 24px;
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
}

.modal-prompt__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-prompt-primary {
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: background 0.2s;
}

.btn-prompt-primary:hover {
  background: var(--accent-hover);
}

.btn-prompt-secondary {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: color 0.2s, border-color 0.2s;
}

.btn-prompt-secondary:hover {
  color: var(--text);
  border-color: #555;
}

/* ——— Footer (index) ——— */
.footer {
  background: var(--surface);
  padding: 30px 20px;
  margin-top: 0;
  border-top: 2px solid var(--border);
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-contacts {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  padding: 12px 10px;
  min-height: 48px;
}

.contact-item:hover {
  color: var(--accent);
}

.contact-item svg {
  width: 14px;
  height: 14px;
  fill: var(--accent);
  flex-shrink: 0;
}

.footer-copyright {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.footer-navigation {
  margin-bottom: 20px;
  text-align: center;
}

.footer-navigation a {
  display: inline-block;
  padding: 12px 15px;
  min-height: 48px;
  line-height: 24px;
  color: var(--text);
  text-decoration: none;
}

.footer-navigation a:hover {
  color: var(--accent);
}

@media (max-width: 600px) {
  .footer-contacts {
    gap: 20px;
  }
}

/* Accessibilité : focus visible */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
