/*
 * Notifications Lou Garū (2026-10-15)
 * Carte blanche dans le flux de la page (jamais en surimpression).
 * Spec : docs/superpowers/specs/2026-10-15-notifications-design.md
 * Utilisé par js/lg-notifications.js (window.lgNotif).
 */

.lg-notif-zone {
  display: flex;
  flex-direction: column;
  margin: 0 0 18px;
}

.lg-notif-zone:empty,
.woocommerce-notices-wrapper:empty {
  display: none;
}

/* Panier vide : carte centrée au-dessus de l'icône */
.lg-cart-empty .lg-notif-zone {
  align-items: center;
  margin-bottom: 24px;
}

.lg-notif + .lg-notif {
  margin-top: 10px;
}

/*
 * Panier, AVANT le passage du JS (chargé en pied de page) : les messages
 * bruts de WooCommerce ont déjà l'allure de la carte, sinon on voit un
 * instant le style par défaut (lien bleu). Reste propre si le JS échoue.
 * Le JS pose data-lg-notif sur la zone et remplace ces blocs par .lg-notif.
 */
body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) {
  margin: 0 0 18px;
}

body.woocommerce-cart .lg-cart-empty .woocommerce-notices-wrapper:not([data-lg-notif]) {
  margin-bottom: 24px;
}

body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) > .woocommerce-error {
  margin: 0;
  padding: 0;
  list-style: none;
  background: none;
  border: 0;
  box-shadow: none;
}

body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) > .woocommerce-message,
body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) > .woocommerce-info,
body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) > .woocommerce-error > li {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 520px;
  margin: 0;
  padding: 12px 14px 12px 46px;
  background: #fff;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 8px 26px rgba(60, 45, 30, 0.13);
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  color: var(--color-text-primary, #1a1a1a);
  overflow-wrap: anywhere;
  list-style: none;
}

body.woocommerce-cart .lg-cart-empty .woocommerce-notices-wrapper:not([data-lg-notif]) > * {
  margin-left: auto;
  margin-right: auto;
}

body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) > * + *,
body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) > .woocommerce-error > li + li {
  margin-top: 10px;
}

body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) > .woocommerce-message::before,
body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) > .woocommerce-info::before,
body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) > .woocommerce-error > li::before {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--color-accent-main, #a1907d);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) > .woocommerce-error > li::before {
  content: "!";
  background: #b5524a;
}

body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) a {
  color: var(--color-accent-main, #a1907d);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

body.woocommerce-cart .woocommerce-notices-wrapper:not([data-lg-notif]) a.button {
  display: none;
}

.lg-notif {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
  max-width: 520px;
  max-height: 400px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 26px rgba(60, 45, 30, 0.13);
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  color: var(--color-text-primary, #1a1a1a);
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.35s ease, padding 0.35s ease, margin 0.35s ease;
}

.lg-notif.is-entree {
  animation: lg-notif-entree 0.3s ease;
}

@keyframes lg-notif-entree {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.lg-notif.is-sortie {
  opacity: 0;
  max-height: 0 !important;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
}

.lg-notif__ic {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-accent-main, #a1907d);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.lg-notif--erreur .lg-notif__ic {
  background: #b5524a;
}

.lg-notif__txt {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Configurateur : plusieurs motifs de refus séparés par des retours à la
   ligne (lg_add_custom_to_cart). Pas sur le panier : le HTML de WooCommerce
   contient des tabulations et retours qui deviendraient des lignes vides. */
#lg-notif-configurateur .lg-notif__txt {
  white-space: pre-line;
}

.lg-notif__txt a,
.lg-notif__action {
  color: var(--color-accent-main, #a1907d);
  font-weight: 600;
  text-decoration: none;
}

.lg-notif__txt a:not(:first-child) {
  margin-left: 6px;
}

.lg-notif__action {
  margin-left: 6px;
  white-space: nowrap;
}

/* Lien « Annuler ? » de WooCommerce */
.lg-notif__txt .restore-item {
  white-space: nowrap;
}

.lg-notif__txt a:hover,
.lg-notif__action:hover {
  text-decoration: underline;
}

.lg-notif .lg-notif__x,
.lg-notif .lg-notif__x:hover,
.lg-notif .lg-notif__x:focus,
.lg-notif .lg-notif__x:active {
  flex: none;
  margin: -4px -4px -4px 4px;
  padding: 4px 6px;
  min-height: 0;
  width: auto;
  background: none;
  border: 0;
  border-radius: 4px;
  box-shadow: none;
  color: #aaa;
  font: inherit;
  font-size: 14px;
  line-height: 1;
  text-transform: none;
  cursor: pointer;
}

.lg-notif .lg-notif__x:hover { color: #555; }
.lg-notif .lg-notif__x:focus-visible { outline: 2px solid #a1907d; outline-offset: 1px; }

.lg-notif__barre {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--color-accent-main, #a1907d);
  transform-origin: left;
  animation: lg-notif-barre 5s linear forwards; /* 5 s = DUREE de js/lg-notifications.js */
}

.lg-notif:hover .lg-notif__barre,
.lg-notif:focus-within .lg-notif__barre {
  animation-play-state: paused;
}

@keyframes lg-notif-barre {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

@media (max-width: 480px) {
  .lg-notif {
    padding: 10px 11px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lg-notif,
  .lg-notif.is-entree {
    animation: none;
    transition: none;
  }
  .lg-notif__barre {
    display: none;
  }
}
