/* =========================================================
   OP THEME v4
   Base commune générale
   Objectif :
   - rendu visuel identique à v2
   - léger ménage / regroupement
   - aucune logique changée
   - compatible avec les classes actuelles des templates
   ========================================================= */

/* =========================================================
   TOKENS VISUELS
   (mêmes couleurs/valeurs que v2)
   ========================================================= */
:root {
  --op-dark: #292929;
  --op-gold: #fbc81d;
  --op-gold-alt: #fbc21a;
  --op-black: #000;
  --op-border: #ccc;
  --op-danger: #e60000;
  --op-light-gray: #e6e6e6;
  --op-cancel-border: #bbb;
}

/* =========================================================
   ANIMATION
   ========================================================= */
@keyframes opFadeInOut {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { opacity: 0; }
}

/* =========================================================
   ALERT / TOAST
   ========================================================= */
#portal-alert,
.portal-alert {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--op-dark);
  color: var(--op-gold);
  padding: 1.2rem 2rem;
  border-radius: 10px;
  font-weight: bold;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 9999;
  display: none;
  animation: opFadeInOut 2s ease-in-out;
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--op-gold);
  color: var(--op-black);
  padding: 1rem 2rem;
  border-radius: 6px;
  font-weight: bold;
  font-size: 16px;
  opacity: 0.95;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  z-index: 9999;
}

/* =========================================================
   PRODUITS — GRILLE GÉNÉRALE
   ========================================================= */
.product-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  padding: 0 10px;
  gap: 18px;
}

.product-block {
  width: 16%;
  min-width: 260px;
  margin: 0;
  box-sizing: border-box;
  border: 1px solid var(--op-border);
  padding: 0.5rem;
  border-radius: 10px;
  background-color: #fff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: auto;
  font-size: 0.85rem;
}

.product-block img {
  max-height: 150px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.product-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
  color: var(--op-dark);
}

.product-info p,
.product-info strong,
.product-info h3 {
  color: var(--op-dark);
}

.product-info strong {
  color: inherit;
}

.product-info h3,
.product-name {
  font-size: 0.95rem;
  line-height: 1.3em;
  margin-bottom: 4px;
}

.product-info .pack-info {
  color: var(--op-danger);
  font-weight: bold;
  font-size: 0.8rem;
  margin: 2px 0;
}

.product-info p.no-produit,
.product-info p.unit-price,
.product-info p.price-line {
  margin: 2px 0;
  font-size: 0.8rem;
  line-height: 1.2em;
}

/* =========================================================
   INPUTS / QUANTITÉ
   - garde le look v2
   - accepte quantity et qty-input
   ========================================================= */
.quantity,
.qty-input,
.product-block input[type="number"] {
  width: 80px;
  margin-left: 5px;
  padding: 6px 8px;
  border: 1px solid var(--op-border);
  border-radius: 6px;
  font-size: 0.9rem;
}

/* =========================================================
   BOUTONS PRODUITS
   - garde le look v2
   - compatible avec classes actuelles
   ========================================================= */
.product-block button,
.product-block .btn-add,
.product-block .Add_to_Cart,
.product-block .Notify_Me {
  background-color: var(--op-gold);
  color: var(--op-black);
  opacity: 0.85;
  border: none;
  padding: 0.75rem;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  transform: scale(1);
}

.product-block button:hover,
.product-block .btn-add:hover,
.product-block .Add_to_Cart:hover,
.product-block .Notify_Me:hover {
  opacity: 1;
  transform: scale(1.03);
}

.product-block button.notify,
.product-block button.Notify_Me,
.product-block .notify,
.product-block .Notify_Me {
  background-color: var(--op-border);
  color: var(--op-black);
  cursor: pointer;
}

/* =========================================================
   INVENTORY GUARD MODAL
   ========================================================= */
#invGuardModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
}

#invGuardModal .bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

#invGuardModal .box {
  position: relative;
  max-width: 520px;
  margin: 12vh auto 0 auto;
  background: var(--op-dark);
  color: var(--op-gold-alt);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  padding: 16px 16px 14px 16px;
  border: 1px solid rgba(251,194,26,.30);
}

#invGuardModal .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#invGuardModal .ttl {
  font-weight: 800;
  font-size: 16px;
  color: var(--op-gold-alt);
}

#invGuardModal .x {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--op-gold-alt);
}

#invGuardModal .txt {
  margin-top: 10px;
  color: var(--op-gold-alt);
  font-size: 14px;
  line-height: 1.35;
}

#invGuardModal .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

#invGuardModal .b {
  flex: 1 1 160px;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 800;
  cursor: pointer;
  color: var(--op-dark);
}

#invGuardModal .b.adjust {
  background: var(--op-gold-alt);
}

#invGuardModal .b.notify {
  background: var(--op-light-gray);
}

#invGuardModal .b.cancel {
  flex: 1 1 120px;
  border: 1px solid var(--op-cancel-border);
  background: #fff;
}

#invGuardModal .note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--op-gold-alt);
}

#invGuardModal .b:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =========================================================
   MOBILE
   ========================================================= */
@media (max-width: 768px) {
  .product-block {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 100%;
    margin-bottom: 1rem;
  }
}

@media (max-width: 640px) {
  #invGuardModal .box {
    margin: 8vh 12px 0 12px;
  }

  #invGuardModal .row {
    flex-direction: column;
  }

  #invGuardModal .b,
  #invGuardModal .b.cancel {
    flex: 1 1 auto;
    width: 100%;
  }
}
/* =========================================================
   PRODUITS — LIGNES MÉTA / QUANTITÉ / HELPERS
   Standard commun pour marteau, batterie, fraises, etc.
   ========================================================= */

.product-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 2px 0;
  font-size: 0.85rem;
}

.product-sku,
.product-price {
  display: block;
}

.product-qty-row {
  display: flex;
  align-items: center;
  margin: 8px 0;
}

.product-qty-label {
  font-size: 0.85rem;
}

.is-hidden {
  display: none;
}
/* =========================================================
   FRAISE — unité + rabais dynamique
   ========================================================= */

.quantity-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
  min-height: 22px;
}

.quantity-row .unite-select {
  width: 80px;
  flex: 0 0 auto;
}

.quantity-row [data-role="discount-text"] {
  min-width: 120px;
  min-height: 20px;
  color: var(--op-danger);
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
}

.price-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 2px 0;
}

/* Header - cart badge */
.navbar-icon {
  position: relative;
}

.cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  transform: translate(40%, -40%);
  min-width: 1.25rem;
  line-height: 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 1rem;
  text-align: center;
  background: #FBC21A;
  color: #292929;
  padding: 0 0.35rem;
  user-select: none;
}

.cart-badge.is-zero {
  display: none;
}