/* ============================================================
   Product Grid Module — productgrid.css
   PrestaShop 1.7.8 compatible
   ============================================================ */

/* ---------- Section ---------- */
.productgrid-section {
  width: 100%;
  padding: 40px 0 50px;
  box-sizing: border-box;
}

/* ---------- Title (same style as categorygrid) ---------- */
.productgrid-title {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 32px;
  color: #1a1a2e;
  letter-spacing: -0.5px;
  position: relative;
}

.productgrid-title::after {
  content: '';
  display: block;
  width: 56px;
  height: 4px;
  background: #e63946;
  border-radius: 2px;
  margin: 10px auto 0;
}

/* ---------- Grid ---------- */
.productgrid-grid {
  display: grid;
  gap: 20px;
  padding: 0 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.productgrid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.productgrid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.productgrid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.productgrid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.productgrid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.productgrid-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* ---------- Card ---------- */
.pg-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.pg-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.14);
}

/* ---------- Image ---------- */
.pg-img-wrap {
  display: block;
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 */
  overflow: hidden;
  background: #fff;
  text-decoration: none;
}

.pg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  transition: transform 0.45s ease;
}

.pg-card:hover .pg-img {
  transform: scale(1.06);
}

.pg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.35s ease;
}

.pg-card:hover .pg-overlay {
  background: rgba(0, 0, 0, 0.12);
}

/* ---------- Sale badge ---------- */
.pg-badge-sale {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #e63946;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  z-index: 2;
}

/* ---------- Body ---------- */
.pg-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
  flex: 1;
}

/* ---------- Name ---------- */
.pg-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a2e;
  text-decoration: none;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}

.pg-name:hover {
  color: #e63946;
}

/* ---------- Short description ---------- */
.pg-desc {
  font-size: 0.78rem;
  color: #888;
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Price row ---------- */
.pg-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}

.pg-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1;
}

.pg-price--sale {
  color: #e63946;
}

.pg-price-old {
  font-size: 0.82rem;
  color: #bbb;
  text-decoration: line-through;
  font-weight: 400;
}

/* ---------- Cart row ---------- */
.pg-cart-row {
  margin-top: auto;
  padding-top: 10px;
}

.pg-add-form {
  margin: 0;
  padding: 0;
}

/* Base button */
.pg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

/* Add to cart */
.pg-btn--cart {
  background: #1a1a2e;
  color: #fff;
}

.pg-btn--cart:hover {
  background:  #efe8db ;
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(230, 57, 70, 0.35);
  color: #173677;
}

/* Animated feedback */
.pg-btn--cart.pg-added {
  background: #2ecc71;
  pointer-events: none;
}

/* Choose options (combinations) */
.pg-btn--options {
  background: #f0f0f0;
  color: #444;
}

.pg-btn--options:hover {
  background: #1a1a2e;
  color: #fff;
}

/* Unavailable */
.pg-btn--unavail {
  background: #f5f5f5;
  color: #bbb;
  cursor: not-allowed;
  font-size: 0.75rem;
}

/* Icon inside button */
.pg-btn-icon {
  font-style: normal;
  line-height: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  .productgrid-cols-6,
  .productgrid-cols-5 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 991px) {
  .productgrid-cols-6,
  .productgrid-cols-5,
  .productgrid-cols-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767px) {
  .productgrid-cols-6,
  .productgrid-cols-5,
  .productgrid-cols-4,
  .productgrid-cols-3 { grid-template-columns: repeat(2, 1fr); }

  .productgrid-title { font-size: 1.4rem; }
}

@media (max-width: 479px) {
  .productgrid-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
    padding: 0 10px;
  }

  .pg-body { padding: 10px 12px 12px; }

  .pg-name { font-size: 0.85rem; }

  .pg-btn { font-size: 0.72rem; padding: 8px 10px; }
}

/* =========================================================
   AGGIUNTE Product Grid Advanced — doppio pulsante
   (Vedi prodotto outlined + Aggiungi filled, in linea su desktop,
    impilati su tablet ≤ 991px e smartphone)
   ========================================================= */
.pg-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: auto;
  padding-top: 10px;
}
.pg-actions > * { flex: 1 1 0; min-width: 0; }
.pg-actions .pg-add-form { flex: 1 1 0; margin: 0; }
.pg-actions .pg-add-form .pg-btn { width: 100%; }

/* Variante outlined per "Vedi prodotto" */
.pg-btn--see {
  background: transparent;
  color: #1a1a2e;
  border: 1px solid #1a1a2e;
}
.pg-btn--see:hover {
  background: #efe8db;
  color: #173677;
  border-color: #efe8db;
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(26, 26, 46, 0.20);
}

/* Icona allineata al testo */
.pg-btn .pg-btn-icon svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* Impila su tablet e smartphone */
@media (max-width: 991px) {
  .pg-actions { flex-direction: column; gap: 6px; }
}

/* =========================================================
   Prezzo secondario "(IVA inclusa/esclusa)"
   Mostrato accanto al principale in modalità both_exc / both_inc.
   ========================================================= */
.pg-price-row {
  justify-content: center;
  flex-wrap: wrap;
}

/* Titolo prodotto sempre alto come 2 righe per allineare le card */
.pg-name {
  min-height: calc(0.95rem * 1.35 * 2);
}

.pg-price-secondary {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.88em;
  color: #8a8a8a;
  font-weight: 400;
  white-space: nowrap;
  vertical-align: baseline;
}

@media (max-width: 575px) {
  .pg-price-secondary {
    display: block;
    margin-left: 0;
    margin-top: 2px;
    font-size: 0.85em;
  }
}
