/* =============================================
   Page d'accueil — Welcome card
   ============================================= */
.welcome-card {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: var(--sp-6);
  box-shadow: var(--shadow-card);
}

.welcome-avatar {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  background: var(--clr-accent-soft);
  color: var(--clr-accent-text);
  font-size: var(--text-xl);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: .04em;
}

.welcome-name { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.015em; }

/* =============================================
   Page d'accueil — Home
   ============================================= */
/* .home-catalog enveloppe les sections Produits et Allergènes dans un même
   composant Alpine — sans quoi les chips ne pourraient pas piloter les cartes.
   Il reprend le layout de .home-page pour que ses sections restent espacées
   comme les autres, au lieu de se coller l'une à l'autre en devenant un seul
   élément flex. */
.home-page,
.home-catalog {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}

.home-vente-cta {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--clr-text);
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-card);
}
.home-vente-cta:hover {
  border-color: var(--clr-accent);
  box-shadow: var(--shadow-md);
}
.home-vente-cta__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--clr-accent);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 1.3rem;
  flex-shrink: 0;
}
.home-vente-cta__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.home-vente-cta__label {
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1;
}
.home-vente-cta__sub {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
}
.home-vente-cta__arrow {
  font-size: .85rem;
  color: var(--clr-text-muted);
  flex-shrink: 0;
}

.home-welcome {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-4);
  align-items: stretch;
}

.home-balance {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  background: var(--clr-accent);
  color: #fff;
  border-radius: var(--radius-md);
  padding: var(--sp-5) var(--sp-6);
  text-decoration: none;
  min-width: 150px;
  transition: opacity .15s;
}
.home-balance:hover { opacity: .9; }
.home-balance__label { font-size: var(--text-xs); opacity: .85; text-transform: uppercase; letter-spacing: .07em; }
.home-balance__amount { font-size: var(--text-3xl); font-weight: 700; line-height: 1; }
.home-balance__cta { font-size: var(--text-xs); opacity: .75; }

.home-section__title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--sp-1);
}
.home-section__sub {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  margin-bottom: var(--sp-4);
}

/* Section allergènes */
.home-allergens__intro {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  margin-bottom: var(--sp-3);
}
.home-allergens__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.home-allergen-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--clr-allergen-bg);
  color: var(--clr-allergen);
  border: 1px solid var(--clr-allergen-border);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
}

/* Variante cliquable de la page d'accueil : filtre les cartes produits.
   min-height 36px — la chip reste compacte mais atteignable au pouce, sa
   hauteur au repos (24px) étant trop faible pour une cible tactile. */
.home-allergen-chip--btn {
  min-height: 36px;
  padding: 4px 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.home-allergen-chip--active {
  background: var(--clr-allergen);
  border-color: var(--clr-allergen);
  color: var(--clr-surface);
}
.home-allergens__legal {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  border-top: 1px solid var(--clr-border);
  padding-top: var(--sp-3);
  margin-top: var(--sp-1);
}
.home-credit {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  opacity: .5;
}
.home-credit a {
  color: inherit;
  text-decoration: none;
}
.home-credit a:hover { opacity: .8; }

/* Grille produits */
.home-products {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}
@media (min-width: 480px) {
  .home-products { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 768px) {
  .home-products { grid-template-columns: repeat(8, 1fr); }
}
.home-product-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, opacity .15s;
  box-shadow: var(--shadow-card);
}
.home-product-card:hover {
  border-color: var(--clr-accent);
  box-shadow: var(--shadow-md);
}

/* Mise en évidence par allergène. Une bordure seule sur trois cartes dispersées
   dans la grille se repère mal, surtout sur mobile où l'on en voit six à la fois :
   estomper les autres rend la réponse lisible d'un coup d'œil.
   opacity plutôt que des couleurs en dur — la carte reste juste en retrait, et
   l'effet vaut pour les deux thèmes sans règle supplémentaire. */
.home-product-card--allergen {
  border-color: var(--clr-allergen);
  box-shadow: 0 0 0 1px var(--clr-allergen), 0 4px 12px var(--clr-allergen-bg);
}
.home-product-card--muted {
  opacity: .35;
}
.home-product-card__img {
  width: 48px; height: 48px;
  object-fit: scale-down;
  border-radius: var(--radius-sm);
}
.home-product-card__emoji { font-size: 1.75rem; line-height: 1; }
.home-product-card__name { font-size: var(--text-xs); font-weight: 600; line-height: 1.3; }
.home-product-card__price { font-size: var(--text-xs); font-weight: 800; color: var(--clr-text); }

/* ── Modal produit (détail depuis la home) ── */
body.modal-open { overflow: hidden; }
body.modal-open .app-content { overflow: hidden; }

.modal-overlay--product { align-items: center; }

.modal.modal--product {
  max-width: min(480px, calc(100vw - 128px));
  height: min(75dvh, calc(100dvh - 32px));
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@media (max-width: 1023px) {
  .modal.modal--product {
    max-width: min(480px, calc(100vw - 128px));
    height: calc(
      100dvh
      - var(--topbar-h)
      - env(safe-area-inset-top, 0px)
      - var(--nav-h)
      - env(safe-area-inset-bottom, 0px)
            - 96px
    );
  }
  .modal-product-visual { height: 25%; }
  .modal--product .modal-body { padding: var(--sp-4); }
  .modal-product-price { font-size: 1.5rem; color: var(--clr-text); }
}

.modal-product-visual {
  width: 100%;
  height: 30%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}
.modal-product-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.modal-product-emoji { font-size: 5rem; line-height: 1; }

.modal--product .modal-body {
  flex: 1;
  min-height: 0;
  padding: var(--sp-5);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-product-category {
  font-size: 11px;
  font-weight: 600;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0 0 var(--sp-1);
}
.modal-product-name {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 var(--sp-2);
}
.modal-product-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--clr-accent-text);
  margin-bottom: var(--sp-3);
}
.modal-product-desc {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  line-height: 1.55;
  margin: 0 0 var(--sp-3);
}
.modal-product-allergens { margin-bottom: var(--sp-3); }
.modal-product-allergens-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--clr-allergen);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: var(--sp-2);
}
.modal-product-allergens-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}
.modal-product-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--clr-border);
  padding: var(--sp-2) var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-product-counter {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--clr-text-muted);
}
.modal-nav-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--clr-text-muted);
  transition: background .15s, color .15s;
}
.modal-nav-btn:hover { background: var(--clr-surface-2); color: var(--clr-text); }
.modal-close {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0,0,0,.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: background .15s;
  z-index: 1;
}
.modal-close:hover { background: rgba(0,0,0,.45); }

/* Liste staff */
.home-staff {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.home-staff-group {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.home-staff-group__role-badge { width: 100%; }
.home-staff-group__desc {
  width: 100%;
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  margin: 0;
  line-height: 1.5;
}
.home-staff-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-card);
}
.home-staff-card__avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--clr-surface-2);
  color: var(--clr-text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: .04em;
}
.home-staff-card__info { display: flex; flex-direction: column; gap: 2px; }
.home-staff-card__name { font-size: var(--text-sm); font-weight: 600; }
.home-staff-card__role { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

.home-staff-card--admin              .home-staff-card__avatar { background: var(--clr-role-admin-bg);              color: var(--clr-role-admin-text); }
.home-staff-card--moderator          .home-staff-card__avatar { background: var(--clr-role-moderator-bg);          color: var(--clr-role-moderator-text); }
.home-staff-card--moderateur_barman  .home-staff-card__avatar { background: var(--clr-role-moderateur_barman-bg);  color: var(--clr-role-moderateur_barman-text); }
.home-staff-card--barman             .home-staff-card__avatar { background: var(--clr-role-barman-bg);             color: var(--clr-role-barman-text); }
.home-staff-card--admin              .home-staff-card__role   { color: var(--clr-role-admin-text); }
.home-staff-card--moderator          .home-staff-card__role   { color: var(--clr-role-moderator-text); }
.home-staff-card--moderateur_barman  .home-staff-card__role   { color: var(--clr-role-moderateur_barman-text); }
.home-staff-card--barman             .home-staff-card__role   { color: var(--clr-role-barman-text); }

.home-staff-card--has-phone {
  border-color: var(--clr-danger);
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.home-staff-card--has-phone:hover { background: var(--clr-surface-2); }
.home-staff-card__wa-icon {
  margin-left: auto;
  flex-shrink: 0;
  color: #25d366;
  opacity: .75;
}
.home-staff-card--has-phone:hover .home-staff-card__wa-icon { opacity: 1; }

@media (max-width: 600px) {
  .home-welcome {
    grid-template-columns: 1fr;
  }
  .home-balance {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-width: unset;
    flex-wrap: wrap;
    row-gap: var(--sp-1);
  }
  .home-balance__cta { width: 100%; text-align: left; }
}

