/* ================================================
   LA CASA DE YUZÓN — CARRITO DE COMPRAS v3
   Diseño profesional y atractivo
   ================================================ */

/* === VARIABLES DE DISEÑO === */
:root {
  --brand:        #FF1493;
  --brand-light:  #FF69B4;
  --brand-pale:   #fff5fb;
  --brand-border: rgba(255, 105, 180, 0.2);
  --wompi:        #182847;
  --wompi-hover:  #0f1a30;

  --text-dark:    #1e293b;
  --text-mid:     #475569;
  --text-light:   #94a3b8;
  --bg-page:      #f1f5f9;
  --bg-card:      #ffffff;
  --bg-subtle:    #f8fafc;
  --border:       #e2e8f0;

  --success:      #10b981;
  --success-pale: #f0fdf4;
  --warning:      #f59e0b;
  --danger:       #ef4444;

  --shadow-sm:    0 1px 3px rgba(0,0,0,0.05);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg:    0 10px 40px rgba(0,0,0,0.09), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-brand: 0 4px 20px rgba(255, 20, 147, 0.2);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* === RESET BASE === */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-page);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--text-dark);
}

/* === LAYOUT PRINCIPAL === */
.carrito-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  flex: 1;
  width: 100%;
}

.carrito-content {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 28px;
  align-items: start;
  animation: fadeInUp 0.4s ease forwards;
}

/* === ANIMACIONES === */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-14px); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* === BARRA DE PASOS (CHECKOUT STEPS) === */
.checkout-steps {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 32px;
  gap: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-light);
  min-width: 100px;
}

.step.active  { color: var(--brand); }
.step.completed { color: var(--success); }

.step-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 8px;
  transition: all 0.3s var(--ease);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 2;
}

.step.active .step-icon {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  box-shadow: var(--shadow-brand);
  transform: scale(1.1);
}

.step.completed .step-icon {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.step-text {
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.3px;
}

.step-line {
  flex: 1;
  max-width: 90px;
  height: 2px;
  background: var(--border);
  margin-bottom: 28px;
}

/* === TÍTULO === */
.carrito-titulo {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 32px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === CARRITO VACÍO === */
.carrito-vacio {
  text-align: center;
  padding: 80px 40px;
  background: var(--bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  max-width: 480px;
  margin: 0 auto;
  border: 1px solid var(--border);
}

.vacio-icon {
  font-size: 72px;
  display: block;
  margin-bottom: 24px;
  animation: float 3s ease-in-out infinite;
}

.carrito-vacio h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.carrito-vacio p {
  color: var(--text-mid);
  margin-bottom: 32px;
  font-size: 1rem;
  line-height: 1.6;
}

.btn-seguir-comprando {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 34px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: white;
  text-decoration: none;
  border-radius: var(--r-lg);
  font-weight: 700;
  font-size: 1rem;
  transition: all 0.25s var(--ease);
  box-shadow: var(--shadow-brand);
}

.btn-seguir-comprando:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(255, 20, 147, 0.35);
}

/* === PANEL IZQUIERDO: ITEMS === */
.carrito-items {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

/* --- Cabecera del panel --- */
.items-panel-header {
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
}

.items-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.items-panel-count {
  background: var(--brand-pale);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--brand-border);
  letter-spacing: 0.3px;
}

/* --- Barra de envío gratis --- */
.free-shipping-bar {
  padding: 14px 28px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-bottom: 1px solid #bbf7d0;
}

.free-shipping-bar.reached {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
}

.shipping-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: #166534;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shipping-progress-track {
  height: 6px;
  background: #bbf7d0;
  border-radius: 3px;
  overflow: hidden;
}

.shipping-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #10b981);
  border-radius: 3px;
  transition: width 0.7s ease;
}

/* --- Cabecera de columnas --- */
.items-header {
  display: grid;
  grid-template-columns: 2.5fr 1fr 1.2fr 1fr 56px;
  gap: 16px;
  padding: 12px 28px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.73rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* --- Item individual --- */
.carrito-item {
  display: grid;
  grid-template-columns: 2.5fr 1fr 1.2fr 1fr 56px;
  gap: 16px;
  align-items: center;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s var(--ease);
}

.carrito-item:last-child { border-bottom: none; }

.carrito-item:hover {
  background: #fdf2f8;
}

/* Producto (imagen + info) */
.item-producto {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.item-producto img {
  width: 82px;
  height: 82px;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: all 0.3s var(--ease);
}

.item-producto img:hover {
  border-color: var(--brand-light);
  transform: scale(1.06);
  box-shadow: var(--shadow-brand);
}

.item-info { min-width: 0; }

.item-info h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 7px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-curso    { background: linear-gradient(135deg, #667eea, #764ba2); color: white; }
.badge-producto { background: linear-gradient(135deg, #f093fb, #f5576c); color: white; }

/* Precio unitario */
.item-precio {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.precio-principal {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand);
}

.precio-cop {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 500;
}

/* Controles de cantidad */
.item-cantidad {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cantidad-form { display: inline; }

.btn-cantidad {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--brand-border);
  background: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: var(--brand);
  transition: all 0.2s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  padding: 0;
  line-height: 1;
}

.btn-cantidad:hover:not(:disabled) {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  transform: scale(1.12);
  box-shadow: 0 2px 10px rgba(255, 20, 147, 0.3);
}

.btn-cantidad:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.cantidad-display {
  font-weight: 800;
  font-size: 1rem;
  min-width: 34px;
  text-align: center;
  color: var(--text-dark);
  background: var(--bg-subtle);
  padding: 5px 10px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
}

/* Subtotal */
.item-subtotal {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.subtotal-principal {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand);
}

/* Botón eliminar */
.item-acciones { text-align: center; }

.btn-eliminar {
  background: none;
  border: 1.5px solid #fca5a5;
  color: var(--danger);
  font-size: 15px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  transition: all 0.2s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-eliminar:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
  transform: scale(1.08);
}

/* === PANEL DERECHO: RESUMEN === */
.carrito-resumen {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
  position: sticky;
  top: 20px;
}

/* Cabecera del resumen */
.resumen-header {
  padding: 18px 24px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.carrito-resumen h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

/* Cuerpo del resumen */
.resumen-body {
  padding: 20px 24px;
}

/* Mini lista de items */
.resumen-items-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.mini-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

.mini-item img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.mini-item-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.mini-item-price {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand);
  flex-shrink: 0;
}

.resumen-divider-mini {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 16px 0;
}

/* Detalles de precio */
.resumen-detalles { margin-bottom: 4px; }

.resumen-linea {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  font-size: 0.88rem;
  color: var(--text-mid);
}

.resumen-divider {
  border: none;
  border-top: 2px dashed var(--border);
  margin: 14px 0;
}

.resumen-total {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--brand-pale);
  border-radius: var(--r-md);
  border: 1.5px solid var(--brand-border);
}

.resumen-total .precio-cop {
  color: var(--text-mid);
  font-size: 0.78rem;
  font-weight: 600;
  display: block;
  text-align: right;
}

.envio-calculado {
  color: var(--text-light);
  font-style: italic;
  font-size: 0.84rem;
}

/* === CÓDIGO DE DESCUENTO === */
.coupon-section {
  margin-bottom: 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.coupon-toggle {
  width: 100%;
  padding: 11px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s;
  gap: 8px;
}

.coupon-toggle:hover { background: var(--brand-pale); }

.coupon-arrow {
  font-size: 0.7rem;
  transition: transform 0.25s var(--ease);
  flex-shrink: 0;
}

.coupon-arrow.open { transform: rotate(180deg); }

.coupon-form-inner {
  display: none;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  gap: 8px;
  align-items: center;
}

.coupon-form-inner.visible { display: flex; }

.coupon-input {
  flex: 1;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}

.coupon-input:focus { border-color: var(--brand); }

.coupon-apply {
  padding: 9px 16px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: var(--r-sm);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.coupon-apply:hover { background: #d4007a; }

/* === TIP DIDÁCTICO === */
.didactic-tip {
  background: linear-gradient(135deg, #fffbeb, #fef9c3);
  border-left: 3px solid var(--warning);
  padding: 12px 14px;
  margin-bottom: 4px;
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  color: #92400e;
  line-height: 1.5;
}

/* === SECCIÓN DE PAGO === */
.payment-section {
  padding: 0 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-wompi {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 15px 20px;
  background: linear-gradient(135deg, #182847, #1e3a6e);
  color: white;
  border: none;
  border-radius: var(--r-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  box-shadow: 0 4px 15px rgba(24, 40, 71, 0.3);
  text-align: center;
  text-decoration: none;
  line-height: 1.3;
}

.btn-wompi small {
  font-weight: 400;
  opacity: 0.8;
  font-size: 0.76rem;
  margin-top: 3px;
}

.btn-wompi:hover {
  background: linear-gradient(135deg, #0f1a30, #182847);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(24, 40, 71, 0.4);
}

/* PayPal container */
#paypal-button-container {
  position: relative;
  z-index: 10000;
  min-height: 50px;
  border-radius: var(--r-sm);
  overflow: hidden;
}

/* === TRUST BADGES === */
.trust-badges {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

.trust-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-mid);
}

.trust-badge-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

/* === BOTONES DE ACCIÓN === */
.action-buttons {
  padding: 0 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-seguir-comprando-small {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  color: var(--brand);
  text-decoration: none;
  border: 2px solid var(--brand-border);
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 0.88rem;
  transition: all 0.2s var(--ease);
  background: white;
}

.btn-seguir-comprando-small:hover {
  background: var(--brand-pale);
  border-color: var(--brand);
  transform: translateY(-1px);
}

.btn-vaciar-carrito {
  width: 100%;
  padding: 11px;
  background: none;
  color: var(--danger);
  border: 2px solid #fca5a5;
  border-radius: var(--r-md);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  transition: all 0.2s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-vaciar-carrito:hover {
  background: #fef2f2;
  border-color: var(--danger);
}

/* === INFO ENVÍO === */
.info-envio {
  background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border-left: 3px solid #60a5fa;
  margin: 12px 0;
  font-size: 0.82rem;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.info-envio::before {
  content: "ℹ️";
  flex-shrink: 0;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .carrito-content {
    grid-template-columns: 1fr;
  }
  .carrito-resumen { position: static; }
}

@media (max-width: 768px) {
  .carrito-container { padding: 16px 14px 60px; }

  .carrito-titulo {
    font-size: 1.5rem;
    margin-bottom: 20px;
  }

  .items-header { display: none; }

  .carrito-item {
    display: grid;
    grid-template-columns: 78px 1fr;
    grid-template-areas:
      "img  info"
      "img  price"
      "qty  subtotal"
      "del  del";
    gap: 8px 12px;
    padding: 16px;
  }

  .item-producto { display: contents; }

  .item-producto img {
    grid-area: img;
    width: 78px;
    height: 78px;
    align-self: center;
  }

  .item-info     { grid-area: info;    align-self: end;   }
  .item-precio   { grid-area: price;   align-self: start; }
  .item-cantidad { grid-area: qty;     align-self: center; }

  .item-subtotal {
    grid-area: subtotal;
    text-align: right;
    justify-self: end;
    align-self: center;
  }

  .item-acciones {
    grid-area: del;
    justify-self: stretch;
  }

  .item-acciones .btn-eliminar {
    width: 100%;
    justify-content: center;
    font-size: 0.85rem;
    padding: 10px;
  }

  .item-acciones .btn-eliminar::after { content: " Eliminar"; }

  .checkout-steps { margin-bottom: 20px; }
  .step { min-width: 72px; }
  .step-line { max-width: 48px; }
  .step-text { font-size: 0.72rem; }
  .step-icon { width: 40px; height: 40px; font-size: 1.1rem; }
}

@media (max-width: 480px) {
  .carrito-container { padding: 12px 12px 50px; }

  .carrito-item {
    grid-template-columns: 68px 1fr;
  }

  .item-producto img {
    width: 68px;
    height: 68px;
  }
}
