/* ==========================================================================
   cart.css — Estilos del sistema de carrito de cotizaciones Isaflor.cl
   Versión: 1.0.0
   ========================================================================== */


/* SweetAlert2 por encima del drawer del carrito (z-index 1201) */
.swal-above-cart { z-index: 1400 !important; }

/* ==========================================================================
   1. CART DRAWER — Panel lateral derecho
   ========================================================================== */

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.cart-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background: #ffffff;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18), -2px 0 8px rgba(0, 0, 0, 0.08);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1201;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-drawer.show {
  transform: translateX(0);
}

html.dark .cart-drawer {
  background: #1a1b23;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Header --- */

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}

html.dark .cart-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.cart-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

html.dark .cart-title {
  color: rgba(255, 255, 255, 0.92);
}

.cart-count-badge {
  background: #f97316;
  color: #ffffff;
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.cart-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: background 0.15s;
}

.cart-close-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

html.dark .cart-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

/* --- Body --- */

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* Scrollbar styling */
.cart-body::-webkit-scrollbar {
  width: 4px;
}
.cart-body::-webkit-scrollbar-track {
  background: transparent;
}
.cart-body::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 4px;
}
html.dark .cart-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}

/* --- Empty state --- */

.cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.cart-empty-icon {
  display: block;
  margin: 0 auto 16px;
  color: #e5e7eb;
}

.cart-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  margin-top: 0;
}

html.dark .cart-empty-title {
  color: rgba(255, 255, 255, 0.7);
}

.cart-empty-text {
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 20px;
  margin-top: 0;
}

.cart-empty-btn {
  display: inline-block;
  padding: 10px 20px;
  background: #f97316;
  color: #ffffff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.cart-empty-btn:hover {
  background: #ea580c;
  color: #ffffff;
}

/* --- Items list --- */

.cart-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid #f0f0f0;
}

html.dark .cart-item {
  background: #252631;
  border-color: rgba(255, 255, 255, 0.07);
}

.cart-item-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
  padding: 4px;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
  margin-bottom: 3px;
  margin-top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.dark .cart-item-name {
  color: rgba(255, 255, 255, 0.9);
}

.cart-item-code {
  font-size: 11px;
  color: #9ca3af;
  font-family: monospace;
  margin-bottom: 8px;
  display: block;
}

.cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- Quantity controls --- */

.qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  line-height: 1;
}

.qty-btn:hover {
  background: #f97316;
  color: #ffffff;
  border-color: #f97316;
}

html.dark .qty-btn {
  background: #1a1b23;
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
}

html.dark .qty-btn:hover {
  background: #f97316;
  color: #ffffff;
  border-color: #f97316;
}

.qty-value {
  min-width: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

html.dark .qty-value {
  color: rgba(255, 255, 255, 0.9);
}

.cart-item-price {
  font-size: 13px;
  font-weight: 700;
  color: #f97316;
}

.cart-item-remove {
  padding: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #9ca3af;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  flex-shrink: 0;
}

.cart-item-remove:hover {
  color: #ef4444;
}

/* --- Footer --- */

.cart-footer {
  padding: 16px 20px;
  border-top: 1px solid #f3f4f6;
  flex-shrink: 0;
}

html.dark .cart-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.cart-subtotal-left {
  display: flex;
  flex-direction: column;
}

.cart-subtotal-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.cart-subtotal-note {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 3px;
}

.cart-subtotal-value {
  font-size: 20px;
  font-weight: 800;
  color: #111827;
}

html.dark .cart-subtotal-value {
  color: #ffffff;
}

.cart-quote-btn {
  width: 100%;
  padding: 14px;
  background: #f97316;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cart-quote-btn:hover {
  background: #ea580c;
}

.cart-quote-btn:active {
  transform: scale(0.99);
}

.cart-clear-btn {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  background: transparent;
  color: #9ca3af;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.cart-clear-btn:hover {
  color: #ef4444;
  border-color: #ef4444;
}

html.dark .cart-clear-btn {
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.4);
}

html.dark .cart-clear-btn:hover {
  color: #ef4444;
  border-color: #ef4444;
}


/* ==========================================================================
   2. QUOTE FORM OVERLAY — Formulario de cotización
   ========================================================================== */

.quote-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.quote-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.quote-panel {
  background: #ffffff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(30px);
  transition: transform 0.35s ease;
  padding: 0;
}

.quote-overlay.show .quote-panel {
  transform: translateY(0);
}

html.dark .quote-panel {
  background: #1a1b23;
}

/* Scrollbar del panel */
.quote-panel::-webkit-scrollbar {
  width: 4px;
}
.quote-panel::-webkit-scrollbar-track {
  background: transparent;
}
.quote-panel::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 4px;
}
html.dark .quote-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}

/* --- Panel Header --- */

.quote-panel-header {
  padding: 24px 24px 16px;
  position: sticky;
  top: 0;
  background: #ffffff;
  border-radius: 16px 16px 0 0;
  z-index: 1;
  border-bottom: 1px solid #f3f4f6;
}

html.dark .quote-panel-header {
  background: #1a1b23;
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

.quote-panel-title {
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  margin: 0 0 4px 0;
}

html.dark .quote-panel-title {
  color: #ffffff;
}

.quote-panel-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.quote-panel-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f3f4f6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: background 0.15s, color 0.15s;
}

.quote-panel-close:hover {
  background: #e5e7eb;
  color: #111827;
}

html.dark .quote-panel-close {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
}

html.dark .quote-panel-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
}

/* --- Cart summary inside quote --- */

.quote-cart-summary {
  margin: 16px 24px;
  padding: 12px 14px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #f3f4f6;
}

html.dark .quote-cart-summary {
  background: #252631;
  border-color: rgba(255, 255, 255, 0.06);
}

.quote-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding: 3px 0;
  color: #4b5563;
}

.quote-summary-item strong {
  color: #111827;
  font-weight: 600;
}

html.dark .quote-summary-item {
  color: rgba(255, 255, 255, 0.6);
}

html.dark .quote-summary-item strong {
  color: rgba(255, 255, 255, 0.9);
}

.quote-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid #e5e7eb;
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

html.dark .quote-summary-total {
  border-top-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.quote-summary-total-value {
  color: #f97316;
  font-size: 15px;
}

/* --- Form --- */

.quote-form {
  padding: 0 24px 24px;
}

.form-row {
  margin-bottom: 16px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

html.dark .form-label {
  color: rgba(255, 255, 255, 0.6);
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #1f2937;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  font-family: inherit;
}

.form-input:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

html.dark .form-input {
  background: #252631;
  border-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

html.dark .form-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

html.dark .form-input:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.form-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-error {
  font-size: 11px;
  color: #ef4444;
  margin-top: 4px;
  display: none;
}

.form-error.show {
  display: block;
}

.quote-submit-btn {
  width: 100%;
  padding: 14px;
  background: #f97316;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  font-family: inherit;
}

.quote-submit-btn:hover:not(:disabled) {
  background: #ea580c;
}

.quote-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Success state --- */

.quote-success {
  text-align: center;
  padding: 40px 24px;
  display: none;
}

.quote-success.show {
  display: block;
}

.quote-success-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.quote-success-title {
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  margin: 0 0 8px 0;
}

html.dark .quote-success-title {
  color: #ffffff;
}

.quote-success-text {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.6;
  margin: 0;
}

.quote-folio-box {
  margin: 12px auto 20px;
  padding: 12px 20px;
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 220px;
}

.quote-folio-label {
  font-size: 11px;
  font-weight: 600;
  color: #9a3412;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quote-folio-number {
  font-size: 22px;
  font-weight: 800;
  color: #ea580c;
  letter-spacing: 1px;
}

html.dark .quote-folio-box {
  background: rgba(249,115,22,0.1);
  border-color: rgba(249,115,22,0.3);
}

html.dark .quote-folio-label { color: #fdba74; }
html.dark .quote-folio-number { color: #fb923c; }


/* ==========================================================================
   3. CART BADGE EN NAVBAR
   ========================================================================== */

.cart-icon-btn {
  position: relative;
  /* Hereda estilos de .nb-icon-btn */
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  background: #f97316;
  color: #ffffff;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  line-height: 1;
}

.cart-badge.has-items {
  opacity: 1;
  transform: scale(1);
}

@keyframes cart-badge-bounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.cart-badge.cart-badge-bounce {
  animation: cart-badge-bounce 0.3s ease;
}


/* ==========================================================================
   4. BOTÓN "AGREGAR AL CARRITO" EN CARDS
   ========================================================================== */

.btn-add-cart {
  position: relative;
  background: #f97316;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  line-height: 1;
}

.btn-add-cart:hover {
  background: #ea580c;
}

.btn-add-cart:active {
  transform: scale(0.97);
}

.btn-add-cart.added {
  background: #16a34a;
}

.btn-add-cart.added:hover {
  background: #15803d;
}


/* ==========================================================================
   5. LOADING SPINNER PARA BOTÓN SUBMIT
   ========================================================================== */

@keyframes cart-spin {
  to { transform: rotate(360deg); }
}

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: cart-spin 0.8s linear infinite;
  flex-shrink: 0;
}

.quote-submit-btn.loading .btn-spinner {
  display: inline-block;
}

.quote-submit-btn.loading .btn-submit-text {
  opacity: 0.7;
}


/* ==========================================================================
   6. RESPONSIVE — Mobile
   ========================================================================== */

@media (max-width: 640px) {
  .cart-drawer {
    width: 100%;
  }

  .quote-overlay {
    align-items: flex-end;
  }

  .quote-panel {
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

/* Desktop: centrar el panel de cotización */
@media (min-width: 641px) {
  .quote-overlay {
    align-items: center;
    justify-content: center;
  }

  .quote-panel {
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
  }
}

/* ==========================================================================
   7. INTEGRACIÓN CON CARDS DE PRODUCTOS (productGridMinimal)
   ========================================================================== */

/*
 * .product-card-outer es el nuevo wrapper visual de cada card.
 * Hereda el border/shadow/radius de .product-card-minimal y envuelve
 * tanto el <a> como el botón "Agregar", haciéndolo parte de la misma card.
 */
.product-card-outer {
  border-radius: 1.5rem;           /* igual que .product-card-minimal */
  border: 1px solid #e5e7eb;
  overflow: hidden;
  background: #ffffff;
  transition: all 400ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.product-card-outer:hover {
  transform: translateY(-0.5rem);
  border-color: transparent;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

/* El <a> dentro del outer no necesita su propio border/shadow/radius */
.product-card-outer .product-card-minimal {
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  transform: none !important;
  flex: 1;
}

/* Botón al fondo de la card, sin espacio extra */
.product-card-outer .btn-add-cart {
  width: 100%;
  border-radius: 0;
  justify-content: center;
  padding: 10px 12px;
  font-size: 13px;
  flex-shrink: 0;
}

/* Dark mode del outer */
html.dark .product-card-outer {
  background: #1e2030;
  border-color: rgba(255,255,255,0.08);
}
html.dark .product-card-outer:hover {
  border-color: transparent;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* Dark mode */
html.dark .cart-drawer        { background: #1a1b23; }
html.dark .cart-header        { border-bottom-color: rgba(255,255,255,0.08); }
html.dark .cart-title         { color: rgba(255,255,255,0.9); }
html.dark .cart-close-btn:hover { background: rgba(255,255,255,0.08); }
html.dark .cart-item          { background: #252631; border-color: rgba(255,255,255,0.07); }
html.dark .cart-item-name     { color: rgba(255,255,255,0.9); }
html.dark .cart-item-code     { color: rgba(255,255,255,0.4); }
html.dark .cart-item-price    { color: #fb923c; }
html.dark .qty-btn            { background: #2d2e3d; border-color: rgba(255,255,255,0.12); color: rgba(255,255,255,0.8); }
html.dark .qty-value          { color: rgba(255,255,255,0.9); }
html.dark .cart-footer        { border-top-color: rgba(255,255,255,0.08); }
html.dark .cart-subtotal-label { color: rgba(255,255,255,0.5); }
html.dark .cart-subtotal-note  { color: rgba(255,255,255,0.3); }
html.dark .cart-subtotal-value { color: #ffffff; }
html.dark .cart-clear-btn     { color: rgba(255,255,255,0.4); border-color: rgba(255,255,255,0.12); }
html.dark .cart-clear-btn:hover { color: #f87171; border-color: #f87171; }
html.dark .quote-panel        { background: #1a1b23; }
html.dark .quote-panel-header { background: #1a1b23; }
html.dark .quote-panel-title  { color: #ffffff; }
html.dark .quote-panel-subtitle { color: rgba(255,255,255,0.5); }
html.dark .quote-panel-close  { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); }
html.dark .quote-cart-summary { background: #252631; border-color: rgba(255,255,255,0.06); }
html.dark .quote-summary-item { color: rgba(255,255,255,0.55); }
html.dark .quote-summary-item strong { color: rgba(255,255,255,0.9); }
html.dark .form-label         { color: rgba(255,255,255,0.55); }
html.dark .form-input         { background: #252631; border-color: rgba(255,255,255,0.12); color: rgba(255,255,255,0.9); }
html.dark .form-input:focus   { border-color: #f97316; }

/* ==========================================================================
   8. PRODUCTO AGREGADO — Modal de confirmación
   ========================================================================== */

.cart-added-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  padding: 1rem;
  pointer-events: none;
  opacity: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.22s ease;
}

.cart-added-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.cart-added-panel {
  position: relative;
  background: #fff;
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.06),
    0 24px 64px rgba(0,0,0,0.22),
    0 4px 16px rgba(0,0,0,0.08);
  padding: 24px 24px 20px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: scale(0.94) translateY(8px);
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.cart-added-overlay.show .cart-added-panel {
  transform: scale(1) translateY(0);
}

/* Botón cerrar (×) */
.cart-added-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f3f4f6;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: background 0.18s, color 0.18s;
}
.cart-added-close:hover {
  background: #e5e7eb;
  color: #111827;
}

/* Fila producto */
.cart-added-product {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 12px;
  padding: 10px 12px;
}

.cart-added-thumbnail {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  flex-shrink: 0;
}

.cart-added-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cart-added-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #f97316;
}

.cart-added-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Fila cantidad */
.cart-added-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-added-qty-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.cart-added-qty-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.cart-qty-step {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 400;
  color: #374151;
  transition: background 0.15s;
  line-height: 1;
  flex-shrink: 0;
}
.cart-qty-step:hover { background: #f3f4f6; }
.cart-qty-step:active { background: #e5e7eb; }

.cart-qty-input {
  width: 44px;
  text-align: center;
  border: none;
  border-left: 1.5px solid #e5e7eb;
  border-right: 1.5px solid #e5e7eb;
  outline: none;
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  background: transparent;
  padding: 0;
  height: 36px;
  -moz-appearance: textfield;
}
.cart-qty-input::-webkit-inner-spin-button,
.cart-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* Botones acción */
.cart-added-actions {
  display: flex;
  gap: 8px;
}

.cart-added-btn-secondary,
.cart-added-btn-primary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
  white-space: nowrap;
}

.cart-added-btn-secondary {
  background: transparent;
  color: #374151;
  border: 1.5px solid #d1d5db;
}
.cart-added-btn-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.cart-added-btn-primary {
  background: #f97316;
  color: #fff;
  box-shadow: 0 4px 14px rgba(249,115,22,0.3);
}
.cart-added-btn-primary:hover {
  background: #ea580c;
  box-shadow: 0 6px 20px rgba(249,115,22,0.4);
  transform: translateY(-1px);
}

/* Dark mode */
html.dark .cart-added-panel {
  background: #1e2330;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 24px 64px rgba(0,0,0,0.5);
}
html.dark .cart-added-close {
  background: rgba(255,255,255,0.08);
  color: #9ca3af;
}
html.dark .cart-added-close:hover {
  background: rgba(255,255,255,0.14);
  color: #f1f5f9;
}
html.dark .cart-added-product {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.07);
}
html.dark .cart-added-name  { color: #f1f5f9; }
html.dark .cart-added-qty-label { color: #d1d5db; }
html.dark .cart-added-qty-stepper {
  background: #2a2d3e;
  border-color: rgba(255,255,255,0.14);
}
html.dark .cart-qty-step    { color: #e5e7eb; background: transparent; }
html.dark .cart-qty-step:hover { background: rgba(255,255,255,0.1); color: #fff; }
html.dark .cart-qty-input {
  color: #f1f5f9;
  background: transparent;
  border-color: rgba(255,255,255,0.14);
}
html.dark .cart-added-btn-secondary {
  color: #d1d5db;
  border-color: rgba(255,255,255,0.15);
}
html.dark .cart-added-btn-secondary:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.3);
}

@media (max-width: 400px) {
  .cart-added-actions { flex-direction: column; }
}

/* ==========================================================================
   9. CART ICON — Wiggle animation cuando hay productos
   ========================================================================== */

@keyframes cart-icon-wiggle {
  0%, 70%, 100% { transform: rotate(0deg); }
  73%  { transform: rotate(-9deg); }
  77%  { transform: rotate(9deg); }
  81%  { transform: rotate(-6deg); }
  85%  { transform: rotate(6deg); }
  89%  { transform: rotate(-3deg); }
  93%  { transform: rotate(3deg); }
  97%  { transform: rotate(0deg); }
}

.cart-icon-btn:has(.cart-badge.has-items) {
  animation: cart-icon-wiggle 2s ease-in-out infinite;
  transform-origin: center top;
}

/* Sin animación al hacer hover */
.cart-icon-btn:has(.cart-badge.has-items):hover {
  animation: none;
}

/* Sin animación cuando el drawer está abierto */
body:has(#cart-drawer.show) .cart-icon-btn:has(.cart-badge.has-items) {
  animation: none;
}
