/* ============================================================
   compras.css — Sección de compras
   Incluye: carrito, buscador + autocompletado, showcase de
            producto, formulario de entrega, métodos de pago,
            steps de progreso, badges de seguridad, confirmación,
            error de pago, loader overlay y toast
   Fuente: fiori_v23_catalogo_3__4___3_.html  líneas ~1746–2036
   ============================================================ */

/* ===== ESTILO MERCADOLIBRE — carrito ===== */
.ml-empty {
  text-align: center;
  padding: 44px 20px;
  color: #aaa;
  background: white;
  border-radius: 10px;
  border: 1px solid var(--border);
  width: 100%;
  box-sizing: border-box;
}
.ml-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f5f5f5;
  border-radius: 10px 10px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
}
.ml-item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: white;
  border: 1px solid var(--border);
  border-top: none;
}
.ml-item-row:last-child { border-radius: 0 0 10px 10px; }
.ml-item-img-wrap {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid #eee;
  background: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ml-item-info { flex: 1; min-width: 0; }
.ml-item-name {
  font-size: 0.9rem;
  color: var(--dark);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 4px;
}
.ml-item-unit { font-size: 0.88rem; color: #111; margin-bottom: 6px; font-weight: 600; }
.ml-item-qty-wrap { display: flex; align-items: center; gap: 0; border: 1px solid #ddd; border-radius: 6px; overflow: hidden; width: fit-content; }
.ml-qty-btn {
  width: 30px; height: 30px;
  background: #f5f5f5;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--dark);
  transition: background 0.15s;
}
.ml-qty-btn:hover { background: #e8e8e8; }
.ml-qty-input {
  width: 36px; height: 30px;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  text-align: center;
  font-size: 0.9rem;
  font-family: 'Lato', sans-serif;
  color: var(--dark);
  outline: none;
}
.ml-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.ml-item-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
}
.ml-item-delete {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--red);
  padding: 2px;
  transition: opacity 0.15s;
}
.ml-item-delete:hover { opacity: 0.65; }

/* ===== LAYOUT PRINCIPAL ===== */
.compras-layout {
  display: flex;
  flex-direction: row;
  gap: 28px;
  align-items: flex-start;
  width: 100%;
}
.compras-main    { flex: 1; min-width: 0; }
.compras-sidebar { flex: 0 0 340px; position: sticky; top: 80px; }

/* ===== ITEMS DEL CARRITO ===== */
.compras-cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: white;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}
.compras-cart-item:hover { background: #fafafa; }

.compras-cart-item-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: #eee;
}
.compras-cart-item-info { flex: 1; min-width: 0; }
.compras-cart-item-name {
  font-family: 'Oswald', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compras-cart-item-price {
  font-size: 0.78rem;
  color: var(--red);
  font-weight: 700;
  margin-top: 1px;
}

/* Controles de cantidad */
.compras-cart-item-controls { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.compras-cart-item-qty {
  width: 26px;
  height: 24px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  font-family: 'Oswald', sans-serif;
  font-size: 0.82rem;
  color: var(--dark);
}
.compras-cart-item-btn {
  width: 22px;
  height: 22px;
  background: var(--dark);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.compras-cart-item-btn:hover { background: #333; }
.compras-cart-item-remove {
  width: 22px;
  height: 22px;
  background: #fff0f0;
  color: var(--red);
  border: 1px solid #fdd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  margin-left: 2px;
}
.compras-cart-item-remove:hover { background: var(--red); color: white; border-color: var(--red); }

/* ===== RESUMEN DE ORDEN (sidebar oscuro) ===== */
.compras-order-summary {
  background: var(--dark);
  color: white;
  border-radius: var(--radius-lg);
  padding: 28px;
}
.compras-order-summary h3 {
  font-family: 'Oswald', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: white;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #333;
}
.compras-order-item { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.compras-order-item-info { flex: 1; }
.compras-order-item-name  { font-size: 0.85rem; color: #ddd; font-weight: 700; }
.compras-order-item-qty   { font-size: 0.78rem; color: #888; margin-top: 2px; }
.compras-order-item-price { font-family: 'Oswald', sans-serif; font-size: 1rem; color: var(--red-light, #ff2a2a); font-weight: 700; }

.compras-order-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.88rem;
  color: #aaa;
  border-bottom: 1px solid #222;
}
.compras-order-line:last-child { border-bottom: none; }
.compras-order-line.total {
  color: white;
  font-weight: 700;
  font-family: 'Oswald', sans-serif;
  font-size: 1.2rem;
  padding-top: 12px;
}
.compras-order-line.total span:last-child { color: var(--red-light, #ff2a2a); }
.compras-free-shipping { color: #0ab84a !important; font-weight: 700; }

/* ===== BUSCADOR DE PRODUCTOS ===== */
.compras-search-wrap { position: relative; }
.compras-search-input {
  width: 100%;
  padding: 22px 60px 22px 26px;
  font-size: 1.2rem;
  font-family: 'Lato', sans-serif;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}
.compras-search-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(217,10,10,0.12);
}
.compras-search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  font-size: 1.2rem;
  pointer-events: none;
}

/* Autocompletado */
.compras-autocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  overflow: hidden;
}
.compras-autocomplete.show { display: block; }
.compras-auto-item {
  padding: 12px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.15s;
  font-size: 0.9rem;
}
.compras-auto-item:last-child { border-bottom: none; }
.compras-auto-item:hover { background: #fff5f5; }
.compras-auto-item-name  { font-weight: 700; color: var(--dark); }
.compras-auto-item-price { font-size: 0.83rem; color: var(--red); font-weight: 700; margin-top: 2px; }

/* ===== SHOWCASE DE PRODUCTO SELECCIONADO ===== */
.compras-product-showcase {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 20px;
}
.compras-product-img {
  width: 180px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  object-fit: cover;
}
.compras-product-info { flex: 1; min-width: 200px; }
.compras-product-name {
  font-family: 'Oswald', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.compras-product-desc  { color: #666; font-size: 0.9rem; line-height: 1.6; margin-bottom: 16px; }
.compras-product-price {
  font-family: 'Oswald', sans-serif;
  font-size: 2rem;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 4px;
}
.compras-product-ship { font-size: 0.82rem; color: #aaa; margin-bottom: 18px; }
.compras-product-ship span { color: #0ab84a; font-weight: 700; }

/* Selector de cantidad */
.compras-qty-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.compras-qty-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}
.compras-qty-btn:hover { border-color: var(--red); background: #fff5f5; color: var(--red); }
.compras-qty-val {
  font-family: 'Oswald', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

/* Botón agregar al carrito */
.btn-compras-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--red);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: var(--radius);
  font-family: 'Oswald', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(217,10,10,0.35);
  width: 100%;
}
.btn-compras-buy:hover { background: var(--red-dark); transform: translateY(-2px); box-shadow: 0 6px 22px rgba(217,10,10,0.45); }

/* ===== FORMULARIO DE ENTREGA ===== */
.compras-form-group { margin-bottom: 18px; }
.compras-form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 6px;
}
.compras-form-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: 'Lato', sans-serif;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}
.compras-form-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(217,10,10,0.10); }
.compras-form-input.error { border-color: #e53935; }
.compras-form-input.valid { border-color: #0ab84a; }
.compras-form-error { font-size: 0.78rem; color: #e53935; margin-top: 3px; display: none; }
.compras-form-error.show { display: block; }
.compras-form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.compras-form-row .compras-form-group { flex: 1; min-width: 130px; }
.compras-form-select {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: 'Lato', sans-serif;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  appearance: none;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.compras-form-select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(217,10,10,0.10); }

/* ===== MÉTODOS DE PAGO ===== */
.compras-pay-tabs { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.compras-pay-tab {
  flex: 1;
  min-width: 90px;
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.compras-pay-tab:hover { border-color: #ccc; }
.compras-pay-tab.active {
  border-color: var(--red);
  background: #fff5f5;
  box-shadow: 0 0 0 3px rgba(217,10,10,0.10);
}
.compras-pay-tab-icon  { font-size: 1.6rem; }
.compras-pay-tab-label {
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #666;
}
.compras-pay-tab.active .compras-pay-tab-label { color: var(--red); }
.compras-pay-panel        { display: none; animation: fadeIn 0.2s ease; }
.compras-pay-panel.active { display: block; }

/* Tarjeta de crédito — iconos inline */
.compras-card-input-wrap { position: relative; }
.compras-card-icons {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
}
.compras-card-icon {
  width: 30px; height: 18px;
  border-radius: 3px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: #666;
}
.compras-card-icon.visa { background: #1a1f71; color: white; }
.compras-card-icon.mc   { background: #eb001b; color: white; }

/* ===== BOTONES DE ACCIÓN ===== */
.btn-compras-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--red);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-family: 'Oswald', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(217,10,10,0.3);
  width: 100%;
}
.btn-compras-primary:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(217,10,10,0.4); }

.btn-compras-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: none;
  color: #666;
  border: 2px solid var(--border);
  padding: 12px 22px;
  border-radius: var(--radius);
  font-family: 'Oswald', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-compras-secondary:hover { border-color: #888; color: var(--dark); }

.compras-btn-row { display: flex; gap: 12px; margin-top: 22px; align-items: center; }
.compras-btn-row .btn-compras-secondary { flex: 0 0 auto; }
.compras-btn-row .btn-compras-primary   { flex: 1; }

/* ===== STEPS DE PROGRESO DE PAGO ===== */
.compras-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
  overflow-x: auto;
  font-size: 1.05rem;
}
.compras-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-family: 'Oswald', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #aaa;
  white-space: nowrap;
}
.compras-step.active { color: var(--red); }
.compras-step.done   { color: #0ab84a; }
.compras-step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  transition: all 0.3s;
}
.compras-step.active .compras-step-num { border-color: var(--red); color: var(--red); background: rgba(217,10,10,0.1); }
.compras-step.done   .compras-step-num { border-color: #0ab84a; color: white; background: #0ab84a; }
.compras-step-sep { color: #ddd; padding: 0 2px; font-size: 0.9rem; }

/* ===== BADGES DE SEGURIDAD ===== */
.compras-sec-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.compras-sec-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: #aaa;
  background: #f9f9f9;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.compras-sec-badge span { font-weight: 700; color: #666; }

/* ===== PANTALLA DE CONFIRMACIÓN ===== */
.compras-confirm-hero  { text-align: center; padding: 40px 20px 28px; }
.compras-confirm-icon  { font-size: 4rem; margin-bottom: 14px; animation: bounceIn 0.6s ease; }
@keyframes bounceIn {
  0%   { transform: scale(0.5); opacity: 0; }
  80%  { transform: scale(1.1); }
  100% { transform: scale(1);   opacity: 1; }
}
.compras-confirm-title {
  font-family: 'Oswald', sans-serif;
  font-size: 2rem;
  color: var(--dark);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.compras-confirm-sub { color: #888; font-size: 0.95rem; margin-bottom: 16px; }
.compras-order-num {
  display: inline-block;
  background: var(--dark);
  color: white;
  font-family: 'Oswald', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 10px 24px;
  border-radius: 30px;
  border: 2px solid var(--red);
}

/* ===== PANTALLA DE ERROR DE PAGO ===== */
.compras-error-hero {
  text-align: center;
  padding: 40px 20px;
  background: var(--dark);
  color: white;
  border-radius: var(--radius-lg);
  margin: 16px 0;
}
.compras-error-icon  { font-size: 3.5rem; margin-bottom: 12px; }
.compras-error-title {
  font-family: 'Oswald', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: var(--red);
}
.compras-error-sub { color: #aaa; font-size: 0.9rem; margin-bottom: 20px; }

/* ===== LOADER OVERLAY DE PAGO ===== */
.compras-loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,17,17,0.88);
  z-index: 9998;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  backdrop-filter: blur(2px);
}
.compras-loader-overlay.show { display: flex; animation: fadeIn 0.2s ease; }
.compras-loader-ring {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--red);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.compras-loader-title {
  font-family: 'Oswald', sans-serif;
  color: white;
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.compras-loader-steps { display: flex; flex-direction: column; gap: 7px; }
.compras-loader-step {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #666;
  font-size: 0.83rem;
  transition: color 0.3s;
}
.compras-loader-step.done   { color: #0ab84a; }
.compras-loader-step.active { color: white; }
.compras-loader-step-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #444;
  transition: background 0.3s;
  flex-shrink: 0;
}
.compras-loader-step.done   .compras-loader-step-dot { background: #0ab84a; }
.compras-loader-step.active .compras-loader-step-dot {
  background: var(--red);
  animation: pulse 0.8s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ===== TOAST DE COMPRAS ===== */
.compras-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  background: var(--dark);
  color: white;
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.35s ease;
  border-left: 4px solid #0ab84a;
  pointer-events: none;
  font-size: 0.88rem;
}
.compras-toast.show        { transform: translateY(0); opacity: 1; }
.compras-toast.error-toast { border-left-color: var(--red); }

/* ===== RESPONSIVE — compras ===== */
@media (max-width: 860px) {
  .compras-layout  { gap: 16px; }
}
@media (max-width: 480px) {
  .compras-steps { font-size: 0.7rem; }
  .compras-step  { padding: 8px 10px; }
  .compras-product-showcase { flex-direction: column; }
  .compras-product-img { width: 100%; }
}