/* ── MOTOR VISUAL DE MAZOS APILADOS, 2 COLUMNAS MÓVIL, SIMILARES Y RELOJ FLASH ── */
.product-card { position: relative !important; min-width: 0; }
.card-img-wrap { position: relative !important; }

.btn-fab-add-mazo {
  position: absolute; top: 10px; right: 10px; z-index: 15;
  width: 34px; height: 34px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.95);
  background: rgba(17, 24, 39, 0.88); color: #ffffff;
  font-size: 1.15rem; font-weight: 900; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.30);
  transition: transform 0.14s ease, background 0.14s ease;
}
.btn-fab-add-mazo:hover { transform: scale(1.09); background: #0f766e; }
.btn-fab-add-mazo.en-mazo { background: #059669; border-color: #a7f3d0; }

.mazo-card-edit-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  padding: 7px 9px; background: #0f172a; border-bottom: 1px solid #1e293b;
}
.btn-edit-swap {
  flex: 1; min-width: 0; padding: 5px 8px; border-radius: 7px; border: 1px solid #38bdf8;
  background: rgba(14, 165, 233, 0.16); color: #e0f2fe;
  font-size: 0.75rem; font-weight: 800; cursor: pointer; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-edit-swap:hover { background: #0284c7; color: #fff; }
.btn-edit-remove {
  padding: 5px 9px; border-radius: 7px; border: 1px solid #f87171;
  background: rgba(220, 38, 38, 0.20); color: #fecaca;
  font-size: 0.75rem; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.btn-edit-remove:hover { background: #dc2626; color: #fff; }

.mazo-stack-card {
  border: 2px solid var(--mazo-color, #4f46e5) !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.10) !important;
}
.mazo-stack-stage {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  background: radial-gradient(circle at center, #f1f5f9 0%, #e2e8f0 100%);
  overflow: hidden; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mazo-stack-layer {
  position: absolute; width: 78%; height: 78%; object-fit: cover;
  border-radius: 12px; background: #fff; border: 2px solid #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.22); transition: transform 0.22s ease;
}
.mazo-stack-layer.back2 { transform: translate(14px, -12px) rotate(6deg) scale(0.92); opacity: 0.78; z-index: 1; }
.mazo-stack-layer.back1 { transform: translate(-13px, -7px) rotate(-5deg) scale(0.95); opacity: 0.88; z-index: 2; }
.mazo-stack-layer.front { transform: translate(0, 5px) rotate(0deg); z-index: 3; }
.mazo-stack-card:hover .mazo-stack-layer.back2 { transform: translate(20px, -16px) rotate(9deg) scale(0.94); }
.mazo-stack-card:hover .mazo-stack-layer.back1 { transform: translate(-19px, -11px) rotate(-8deg) scale(0.96); }
.mazo-stack-card:hover .mazo-stack-layer.front { transform: translate(0, 2px) scale(1.02); }

.badge-mazo-top {
  position: absolute; top: 8px; left: 8px; z-index: 6;
  max-width: calc(100% - 54px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--mazo-color, #4f46e5); color: #fff;
  font-size: 0.72rem; font-weight: 800; padding: 4px 10px;
  border-radius: 999px; box-shadow: 0 3px 8px rgba(0,0,0,0.22);
}
.badge-mazo-count {
  position: absolute; bottom: 8px; right: 8px; z-index: 6;
  background: rgba(15, 23, 42, 0.88); color: #fde68a;
  font-size: 0.73rem; font-weight: 800; padding: 4px 10px; border-radius: 999px;
}

.mazo-popover-backdrop { position: fixed; inset: 0; z-index: 9990; background: rgba(15, 23, 42, 0.42); }
.mazo-popover-box {
  position: fixed; z-index: 9995; width: min(305px, calc(100vw - 24px));
  background: #fff; border-radius: 14px; border: 1px solid #e2e8f0;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.28); padding: 12px; font-size: 0.85rem;
}
.mazo-modal-editor {
  position: fixed; z-index: 9996; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 20px)); max-height: 84vh;
  background: #fff; border-radius: 16px; border: 1px solid #cbd5e1;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.35);
  display: flex; flex-direction: column; overflow: hidden;
}
.mazo-modal-head {
  padding: 12px 15px; background: #0f172a; color: #fff;
  display: flex; justify-content: space-between; align-items: center;
}
.mazo-modal-search { padding: 10px 14px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; display: flex; gap: 8px; }
.mazo-modal-search input { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid #cbd5e1; font-size: 0.88rem; }
.mazo-modal-list { padding: 10px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.mazo-alt-row {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border: 1px solid #e2e8f0; border-radius: 10px; background: #fff;
}
.mazo-alt-row img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid #e5e7eb; }
.mazo-alt-info { flex: 1; min-width: 0; }
.mazo-alt-title { font-size: 0.83rem; font-weight: 800; color: #0f172a; line-height: 1.25; }

.mazo-pop-title { font-weight: 800; color: #0f172a; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.mazo-pop-list { display: flex; flex-direction: column; gap: 5px; max-height: 210px; overflow-y: auto; margin-bottom: 8px; }
.mazo-pop-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 8px; border: 1px solid #e5e7eb;
  background: #f8fafc; cursor: pointer; font-weight: 700; text-align: left;
}
.mazo-pop-item.activo { background: #ecfdf5; border-color: #10b981; color: #065f46; }
.mazo-pop-item.directo { background: #eef2ff; border-color: #6366f1; color: #312e81; }
.mazo-pop-new { display: flex; gap: 6px; }
.mazo-pop-new input { flex: 1; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.82rem; }
.mazo-pop-new button { padding: 6px 10px; border: none; border-radius: 8px; background: #111827; color: #fff; font-weight: 800; cursor: pointer; }

.mazo-subfilter-wrap {
  background: #fff; border: 2px solid #e2e8f0; border-radius: 14px;
  padding: 14px; margin-bottom: 14px; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}
.mazo-gamas-bar, .mazo-tabs-bar {
  display: flex; gap: 7px; overflow-x: auto; padding-bottom: 8px;
  margin-bottom: 10px; border-bottom: 1px solid #e5e7eb; scrollbar-width: thin;
}
.pill-gama-mazo, .tab-mazo-btn {
  white-space: nowrap; padding: 6px 12px; border-radius: 999px;
  border: 1px solid #cbd5e1; background: #f8fafc; color: #1e293b;
  font-size: 0.8rem; font-weight: 800; cursor: pointer;
}
.pill-gama-mazo.active, .tab-mazo-btn.active { background: #111827; color: #fde68a; border-color: #111827; }
.mazo-hero-summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.mazo-hero-price { font-size: 1.45rem; font-weight: 900; color: #b91c1c; }
.mazo-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-mazo-primary { background: #111827; color: #fde68a; border: none; padding: 9px 14px; border-radius: 10px; font-weight: 800; cursor: pointer; }
.btn-mazo-wsp { background: #15803d; color: #fff; border: none; padding: 9px 14px; border-radius: 10px; font-weight: 800; cursor: pointer; }
.btn-mazo-sec { background: #f1f5f9; color: #0f172a; border: 1px solid #cbd5e1; padding: 8px 12px; border-radius: 10px; font-weight: 700; cursor: pointer; }

.mazo-similares-section {
  margin-top: 22px; padding-top: 16px; border-top: 2px dashed #cbd5e1;
}
.mazo-similares-head { margin-bottom: 12px; }
.mazo-similares-title { font-size: 1.04rem; font-weight: 900; color: #0f172a; }
.mazo-similares-sub { font-size: 0.82rem; color: #475569; margin-top: 2px; }

.cart-flash-timer-box {
  background: linear-gradient(90deg, #111827 0%, #1e293b 100%);
  color: #fde68a; border: 1px solid #f59e0b; border-radius: 10px;
  padding: 8px 11px; margin-bottom: 8px; font-size: 0.8rem;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.cart-flash-expired-box {
  background: #fef2f2; color: #991b1b; border: 1px dashed #f87171;
  border-radius: 10px; padding: 7px 10px; margin-bottom: 8px; font-size: 0.77rem;
}

/* ── OPTIMIZACIÓN MÓVIL: 2 TARJETAS POR VISTA EN MAZOS Y SIMILARES ── */
@media (max-width: 680px) {
  #grillaMazosDedicada.grid,
  #grillaSimilaresMazo.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  #grillaMazosDedicada .product-card,
  #grillaSimilaresMazo .product-card {
    border-radius: 10px !important;
  }

  #grillaMazosDedicada .btn-fab-add-mazo,
  #grillaSimilaresMazo .btn-fab-add-mazo {
    top: 6px; right: 6px; width: 30px; height: 30px; font-size: 1.02rem;
  }

  #grillaMazosDedicada .mazo-card-edit-bar { padding: 5px 6px; gap: 4px; }
  #grillaMazosDedicada .btn-edit-swap { padding: 4px 5px; font-size: 0.67rem; border-radius: 6px; }
  #grillaMazosDedicada .btn-edit-remove { padding: 4px 6px; font-size: 0.67rem; border-radius: 6px; }

  #grillaMazosDedicada .badge-mazo-top {
    top: 6px; left: 6px; font-size: 0.62rem; padding: 3px 7px; max-width: calc(100% - 44px);
  }
  #grillaMazosDedicada .badge-mazo-count {
    bottom: 6px; right: 6px; font-size: 0.62rem; padding: 3px 7px;
  }

  #grillaMazosDedicada .card-body,
  #grillaSimilaresMazo .card-body { padding: 7px 8px !important; }

  #grillaMazosDedicada .card-store,
  #grillaSimilaresMazo .card-store {
    font-size: 0.62rem !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  #grillaMazosDedicada .card-title,
  #grillaSimilaresMazo .card-title {
    font-size: 0.75rem !important; line-height: 1.22 !important;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }

  #grillaMazosDedicada .card-body ul,
  #grillaSimilaresMazo .card-body ul { margin: 3px 0 !important; padding-left: 0 !important; }
  #grillaMazosDedicada .card-body ul li,
  #grillaSimilaresMazo .card-body ul li {
    font-size: 0.64rem !important; line-height: 1.2 !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #grillaMazosDedicada .card-body ul li:nth-child(n+3),
  #grillaSimilaresMazo .card-body ul li:nth-child(n+3) { display: none !important; }

  #grillaMazosDedicada .price-now,
  #grillaSimilaresMazo .price-now { font-size: 0.94rem !important; }
  #grillaMazosDedicada .price-old,
  #grillaSimilaresMazo .price-old { font-size: 0.68rem !important; }
  #grillaMazosDedicada .card-tax-note,
  #grillaSimilaresMazo .card-tax-note {
    font-size: 0.62rem !important; line-height: 1.15 !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  #grillaMazosDedicada .card-actions,
  #grillaSimilaresMazo .card-actions {
    display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 4px !important; margin-top: 5px !important;
  }
  #grillaMazosDedicada .card-sin-stock .card-actions,
  #grillaSimilaresMazo .card-sin-stock .card-actions { grid-template-columns: 1fr !important; }
  #grillaMazosDedicada .card-actions button,
  #grillaSimilaresMazo .card-actions button {
    padding: 6px 3px !important; font-size: 0.68rem !important; min-width: 0 !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 7px !important;
  }

  .mazo-subfilter-wrap { padding: 10px 11px; margin-bottom: 10px; border-radius: 12px; }
  .mazo-gamas-bar, .mazo-tabs-bar { gap: 5px; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
  .pill-gama-mazo, .tab-mazo-btn { padding: 5px 10px; font-size: 0.74rem; }
  .mazo-hero-summary { gap: 8px; }
  .mazo-hero-summary h2 { font-size: 0.98rem !important; }
  .mazo-hero-price { font-size: 1.22rem; }
  .mazo-hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
  .mazo-hero-actions .btn-mazo-primary { grid-column: 1 / -1; }
  .btn-mazo-primary, .btn-mazo-wsp, .btn-mazo-sec { padding: 7px 8px; font-size: 0.75rem; text-align: center; }
}

/* COMPACTACION_EXTRA_2COL_V1 */
@media (max-width: 680px) {
  #grillaMazosDedicada .product-card *,
  #grillaSimilaresMazo .product-card * { box-sizing: border-box; }
  #grillaMazosDedicada .product-card [class*="envio"],
  #grillaSimilaresMazo .product-card [class*="envio"],
  #grillaMazosDedicada .product-card [class*="distrito"],
  #grillaSimilaresMazo .product-card [class*="distrito"] {
    font-size: 0.62rem !important; padding: 3px 5px !important; line-height: 1.15 !important;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  }
  #grillaMazosDedicada .product-card [class*="sku"],
  #grillaSimilaresMazo .product-card [class*="sku"],
  #grillaMazosDedicada .product-card [class*="header"],
  #grillaSimilaresMazo .product-card [class*="header"] {
    font-size: 0.61rem !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
}
