/* =======================================================
   CSS Optimizado (organizado, sin perder funcionalidades)
   ======================================================= */

/* 0) VARIABLES (Unificadas y alineadas) */
:root {
  --color-primary: #FF6600;
  --color-secondary: #1A1A1A;
  --color-cta: #D95300;
  --color-cta-darker: #A64000;
  --color-link: #5C7C99;
  --color-background: #F7F7F7;
  --color-bg-light: var(--color-background);
  --color-white: #ffffff;

  --color-text-dark: #333;
  --color-text-muted: #666;
  --color-border-light: #e0e0e0;

  --color-whatsapp: #25D366;
  --color-secondary-btn: #4a4a4a;
  --color-secondary-btn-hover: #2e2e2e;
  --color-danger: #a33a3a;

  --radius-md: 10px;
  --shadow-elevation: 0 4px 10px rgba(0,0,0,.10);
}

/* =======================================================
   1) BASE, RESET Y LAYOUT GLOBAL
   ======================================================= */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: row;
  font-family: 'Inter', Arial, sans-serif;
  background-color: var(--color-background);
  color: var(--color-text-dark);
  font-size: 16px;
  line-height: 1.5;
}

/* Contenedor principal (permite scroll vertical) */
.content-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 100vh;
  height: 100vh;
  overflow-y: auto;
}

/* Contenido Principal */
.main-content {
  flex-grow: 1;
  padding: 40px 40px 20px;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
}

/* Enlaces de título de producto */
.product-title-link { text-decoration: none; color: inherit; }
.product-title-link:hover .product-title { color: var(--color-link); }

/* Botón WhatsApp flotante */
.whatsapp-float {
  position: fixed;
  width: 60px; height: 60px;
  background-color: var(--color-whatsapp);
  color: var(--color-white);
  border-radius: 50%;
  bottom: 30px; right: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  text-decoration: none;
  box-shadow: 2px 2px 10px rgba(0,0,0,.2);
  z-index: 1000;
  transition: background-color .2s;
}
.whatsapp-float:hover { background-color: #128C7E; }

/* =======================================================
   2) SIDEBAR
   ======================================================= */
.sidebar {
  width: 260px;
  background-color: var(--color-secondary);
  color: var(--color-white);
  padding: 24px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar h2 {
  text-align: center;
  font-size: 28px;
  margin-bottom: 40px;
}

/* Regla única para enlaces del menú (reemplaza duplicados) */
.sidebar .menu-principal a {
  color: #c7c7c7;
  text-decoration: none;
  display: block;
  padding: 12px 0;
  font-size: 14px;
  font-weight: bold;
  transition: color .2s;
  margin-bottom: 5px;
}
.sidebar .menu-principal a:hover { color: var(--color-white); }

.sidebar .menu-principal a.active {
  color: var(--color-primary);
  font-weight: bolder;
  text-decoration: none;
  border-left: 3px solid var(--color-primary);
  padding-left: 21px;
}

.sidebar .info-contacto { margin-top: auto; font-size: 14px; }

/* =======================================================
   3) HERO / BANNER
   ======================================================= */
.banner {
  background-image: linear-gradient(90deg, var(--color-primary) 0%, #FF9933 100%);
  color: var(--color-white);
  padding: 100px 50px;
  text-align: center;
}
.banner h1 { font-size: 42px; margin: 0; }

.boton-banner {
  background-color: var(--color-white);
  color: var(--color-text-dark);
  padding: 12px 24px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: bold;
  display: inline-block;
  margin-top: 20px;
  transition: background-color .2s;
}
.boton-banner:hover { background-color: #eee; }

/* Hero animado adicional */
@keyframes gradient-animation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.hero-section {
  background: linear-gradient(to right, #FF7B00, #FFA500, #FF7B00);
  background-size: 400% 400%;
  animation: gradient-animation 15s ease infinite;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 350px; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.3);
  padding: 20px;
}
.hero-section h1 { font-size: 3em; font-weight: 900; margin-bottom: 20px; color: #fff; }
.hero-section .btn-cta {
  background-color: #fff; color: #FF7B00; border: none;
  padding: 15px 30px; border-radius: 50px; font-size: 1.2em; font-weight: bold;
  text-decoration: none; transition: transform .3s ease, background-color .3s ease;
}
.hero-section .btn-cta:hover { transform: translateY(-3px); background-color: #f0f0f0; }

/* =======================================================
   4) SECCIÓN DE PRODUCTOS, GRID Y TARJETAS
   ======================================================= */
.productos, .cart-page-content, .checkout-content {
  padding: 40px;
  background-color: var(--color-background);
}

.productos h1, .productos h2, .productos h3,
.cart-page-content h1, .checkout-content h1 {
  font-size: 24px;
  color: var(--color-text-dark);
  margin: 0 0 20px;
}

/* Filtros */
.filter-controls { margin-bottom: 30px; display: flex; flex-wrap: wrap; gap: 10px; }
.filter-btn {
  background-color: #eee;
  color: var(--color-text-dark);
  border: none;
  padding: 10px 15px; border-radius: 20px; cursor: pointer;
  font-weight: bold; font-size: 14px;
  transition: background-color .2s, color .2s;
}
.filter-btn:hover { background-color: #ddd; }
.filter-btn.active { background-color: var(--color-primary); color: var(--color-white); }

/* Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
}

/* Tarjeta de producto (consolidada) */
.product-card {
  background-color: var(--color-white);
  border-radius: 8px;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 350px;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  transition: transform .3s ease, box-shadow .3s ease;
}
.product-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,.15); }

.product-card img {
  width: 100%; height: auto; object-fit: contain;
}

.product-card .product-info {
  padding: 15px; text-align: center; flex-grow: 1;
  display: flex; flex-direction: column;
}

/* Oculta categoría si es el primer <p> */
.product-card .product-info .product-category { display: none; margin: 0; padding: 0; }
.product-card .product-info p:first-child { display: none; margin: 0; padding: 0; }

.product-card .product-title {
  font-size: 16px; font-weight: bold; color: #222; margin: 5px 0;
}
.product-card .product-price {
  font-size: 18px; font-weight: bold; color: var(--color-link); margin: 10px 0;
}

/* Botón comprar */
.product-card .btn-comprar {
  background-color: var(--color-cta); color: var(--color-white);
  text-decoration: none; padding: 12px 0; border-radius: 5px;
  font-weight: bold; font-size: 14px; margin-top: auto;
  transition: background-color .2s; display: block;
}
.product-card .btn-comprar:hover { background-color: var(--color-cta-darker); }

/* Badges & estados (consolidados) */
.product-card.sold-out img { filter: grayscale(.2); opacity: .65; }
.product-card .soldout-badge,
.product-card .available-badge{
  position: absolute; top: 4px; left: 4px;
  padding: 4px 8px; font-size: 11px; font-weight: 800;
  color: #fff; border-radius: 6px; z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  pointer-events: none;
}
.product-card .soldout-badge { background: #a33a3a; }
.product-card .available-badge { background: #2e7d32; }

.product-card .btn-comprar.disabled,
#product-detail-button.disabled{
  background:#9a9a9a !important;
  cursor:not-allowed; pointer-events:none; opacity:.8;
}

/* =======================================================
   5) DETALLE DE PRODUCTO
   ======================================================= */
.product-detail-container {
  display: flex; max-width: 1000px; margin: 40px auto; gap: 40px;
  background-color: var(--color-white);
  padding: 30px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,.05);
}
.product-image-column { flex-basis: 40%; flex-shrink: 0; }
#product-detail-image {
  width: 100%; height: auto; max-width: 400px; display: block; border-radius: 6px;
}
.product-info-column { flex-basis: 60%; text-align: center; }
#product-detail-button {
  background-color: var(--color-cta); color: var(--color-white);
  text-decoration: none; padding: 12px 24px; border-radius: 5px;
  font-weight: bold; font-size: 16px; display: inline-block;
  margin-top: 20px; transition: background-color .2s;
}
#product-detail-button:hover { background-color: var(--color-cta-darker); }

/* =======================================================
   6) CARRITO (tabla y resumen)
   ======================================================= */
#checkout-container {
  max-width: 1000px; margin: 40px auto; padding: 0 20px;
  display: flex; flex-direction: column; gap: 20px;
}

.cart-items-container {
  display: flex; flex-direction: column; width: 100%; margin-top: 10px;
  background-color: var(--color-white);
  border-radius: 12px; padding: 20px;
  box-shadow: 0 10px 20px rgba(0,0,0,.05);
}

.cart-header {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr .5fr;
  font-weight: bold; padding: 10px 0;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-secondary); text-align: center;
  margin-bottom: 15px; font-size: 14px; letter-spacing: .5px;
}
.cart-header .header-name { text-align: left; padding-left: 10px; }

.cart-item {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr .5fr;
  padding: 20px 0; border-bottom: 1px solid #f0f0f0;
  align-items: center; text-align: center; font-size: 15px;
}
.cart-item:last-child { border-bottom: none; }

.cart-item .item-name {
  text-align: left; font-weight: 600; padding-left: 10px; color: var(--color-text-dark);
}
.cart-item .item-price, .cart-item .item-subtotal {
  font-weight: bold; color: var(--color-secondary);
}

/* Cantidad */
.cart-item .item-quantity {
  display: flex; justify-content: center; align-items: center;
  gap: 0; border: 1px solid #ddd; border-radius: 4px; width: 90px; margin: 0 auto;
}
.cart-item .item-quantity button {
  background-color: var(--color-white); border: none; padding: 5px 8px;
  cursor: pointer; font-weight: bold; font-size: 16px; color: var(--color-primary);
  border-radius: 0; transition: background-color .2s;
}
.cart-item .item-quantity button:hover { background-color: #f0f0f0; }
.cart-item .item-quantity span {
  font-size: 15px; font-weight: 600; min-width: 25px; text-align: center;
  border-left: 1px solid #eee; border-right: 1px solid #eee; padding: 5px 0;
}

/* Eliminar */
.btn-remove {
  background-color: var(--color-cta); color: var(--color-white);
  border: none; width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; font-weight: bold; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background-color .2s; margin: 0 auto;
}
.btn-remove:hover { background-color: var(--color-cta-darker); }

/* Resumen */
.cart-summary {
  display: flex; flex-direction: column; align-items: flex-end;
  margin-top: 30px; padding: 20px 30px;
  background-color: var(--color-white);
  border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,.05);
  border: 1px solid var(--color-border-light);
  width: 380px; margin-left: auto;
}
.cart-summary .summary-line {
  display: flex; justify-content: space-between; width: 100%;
  padding: 8px 0; font-size: 16px; color: #444;
}
.cart-summary .discount-line { color: #28a745; font-weight: bold; }
.cart-summary .total-line {
  font-size: 26px; font-weight: bolder; color: var(--color-cta);
  border-top: 2px solid var(--color-border-light);
  padding-top: 15px; margin-top: 15px;
}

/* CTA checkout (consolidado) */
.btn-checkout {
  display: inline-block; width: 100%;
  background: var(--color-cta); color: var(--color-white);
  padding: 15px 35px; font-weight: bold; border-radius: 5px;
  cursor: pointer; text-decoration: none; margin-top: 25px;
  transition: background .2s, transform .1s, box-shadow .2s;
  font-size: 18px; letter-spacing: .5px;
  box-shadow: 0 3px 6px rgba(0,0,0,.15);
}
.btn-checkout:hover {
  background: var(--color-cta-darker);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,.15);
}

/* =======================================================
   7) CHECKOUT (página)
   ======================================================= */
.checkout-box {
  max-width: 600px; margin: 40px auto; background-color: var(--color-white);
  padding: 40px; border-radius: 16px; box-shadow: var(--shadow-elevation);
  border: 1px solid var(--color-border-light);
}
.checkout-box h1 {
  color: var(--color-secondary);
  text-align: center; font-size: 30px; margin-bottom: 30px;
}

.checkout-summary {
  background: #fff3e6;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 25px;
  text-align: center;
  margin-bottom: 30px;
}
.checkout-summary h2 {
  color: var(--color-primary);
  font-size: 36px;
  margin: 10px 0 0 0;
}
#final-total { font-size: 42px; font-weight: 800; color: var(--color-primary); margin-top: 10px; }

.payment-instructions { margin-top: 30px; }
.payment-instructions h2 {
  margin-top: 40px; margin-bottom: 20px; font-size: 24px;
  border-bottom: 2px solid #eee; padding-bottom: 5px;
}

.payment-method {
  background: #fdfdfd; border: 1px solid #eee;
  border-radius: var(--radius-md); padding: 15px 20px; margin-bottom: 15px;
  border-left: 5px solid var(--color-primary);
}
.payment-method h4 { margin-top: 0; color: var(--color-secondary); }
.payment-method p { margin: 5px 0 0; font-size: 16px; color: var(--color-text-dark); }

.use-wallet-section {
  padding: 20px; border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md); margin-bottom: 25px; background-color: #fcfcfc;
}
.use-wallet-section label { font-weight: 600; color: var(--color-text-dark); margin: 0; }

.final-step {
  text-align: center; font-weight: bold; color: var(--color-cta);
  margin-top: 30px; font-size: 16px; font-style: italic;
  color: var(--color-text-muted); padding-top: 20px; border-top: 1px solid var(--color-border-light);
}

#whatsapp-order-btn { width: 100%; display: block; text-align: center; }

/* Mensajes */
.msg {
  margin-top: 15px; padding: 12px; border-radius: var(--radius-md);
  font-weight: 600; font-size: 14px; display: none;
}
.msg.ok { background: #e8f8ee; color: #2d7a46; border: 1px solid #9dd2a6; }
.msg.err { background: #fdecec; color: #a33a3a; border: 1px solid #e8a1a1; }

/* Layout horizontal opcional */
.checkout-layout { display: flex; flex-wrap: wrap; gap: 40px; margin-top: 30px; }
.order-summary-block { flex: 1; min-width: 300px; }
.payment-instructions-block { flex: 1.5; min-width: 350px; }

/* =======================================================
   8) FOOTER
   ======================================================= */
.main-footer {
  background-color: var(--color-secondary); color: #c7c7c7;
  padding: 30px 40px; display: flex; justify-content: space-between; gap: 30px; border-top: 5px solid var(--color-primary); flex-wrap: wrap;
}
.main-footer h4 { color: var(--color-white); font-size: 16px; margin: 0 0 15px; }
.main-footer p, .main-footer li { font-size: 13px; line-height: 1.8; margin: 0; }
.main-footer ul { list-style: none; padding: 0; }
.main-footer a { color: #c7c7c7; text-decoration: none; transition: color .2s; }
.main-footer a:hover { color: var(--color-primary); }

/* =======================================================
   9) BADGE DEL CARRITO
   ======================================================= */
.cart-badge {
  background-color: var(--color-cta); color: var(--color-white);
  border-radius: 50%; padding: 3px 7px; font-size: 10px; font-weight: 900; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; margin-left: 8px; transition: transform .2s ease-out;
}
.cart-badge.pulse { animation: badge-pulse .5s; }
@keyframes badge-pulse { 0%{transform:scale(1)} 50%{transform:scale(1.2)} 100%{transform:scale(1)} }

/* =======================================================
   10) CARRITO FLOTANTE (panel lateral)
   ======================================================= */
.floating-cart-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1001; opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.floating-cart-container {
  position: fixed; top: 0; right: 0; width: 100%; max-width: 400px; height: 100%;
  background: var(--color-white); box-shadow: -5px 0 15px rgba(0,0,0,.15); z-index: 1002;
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .3s ease-in-out;
}
body.cart-is-open .floating-cart-overlay { opacity: 1; visibility: visible; }
body.cart-is-open .floating-cart-container { transform: translateX(0); }

.floating-cart-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 20px; border-bottom: 1px solid var(--color-border-light);
}
.floating-cart-header h3 { margin: 0; font-size: 20px; color: var(--color-text-dark); }
.floating-cart-header .close-btn {
  background: none; border: none; font-size: 28px; color: var(--color-text-muted); cursor: pointer;
}

.floating-cart-items { flex-grow: 1; overflow-y: auto; padding: 20px; }
.floating-cart-items .empty-message { text-align: center; color: var(--color-text-muted); margin-top: 40px; }

.f-cart-item {
  display: flex; gap: 15px; margin-bottom: 20px; border-bottom: 1px solid var(--color-border-light); padding-bottom: 20px;
}
.f-cart-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; }
.f-cart-item-info { flex-grow: 1; }
.f-cart-item-info h5 { margin: 0 0 5px; font-size: 15px; }
.f-cart-item-info .price { font-size: 14px; color: var(--color-link); }
.f-cart-item-info .qty { font-size: 13px; color: var(--color-text-muted); }
.f-cart-item-remove {
  background: none; border: none; font-size: 14px; color: var(--color-danger);
  cursor: pointer; font-weight: 700;
}

.floating-cart-footer {
  padding: 20px; border-top: 2px solid var(--color-border-light); background: #fdfdfd;
}
.floating-cart-subtotal {
  display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; margin-bottom: 20px;
}
.floating-cart-subtotal span:last-child { color: var(--color-primary); }
.floating-cart-footer .btn-checkout { display: block; width: 100%; text-align: center; text-decoration: none; }

/* =======================================================
   11) BOTÓN CARRITO FLOTANTE
   ======================================================= */
.cart-float {
  position: fixed; width: 60px; height: 60px; bottom: 100px; right: 30px;
  background-color: var(--color-primary); color: var(--color-white); border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  font-size: 24px; text-decoration: none; box-shadow: 2px 2px 10px rgba(0,0,0,.2);
  z-index: 999; transition: background-color .2s, transform .2s; transform: scale(.8);
}
.cart-float.visible { display: flex; transform: scale(1); }
.cart-float:hover { background-color: var(--color-cta); }
.cart-float .cart-badge-float {
  position: absolute; top: -5px; right: -5px;
  background-color: var(--color-cta); color: #fff; border-radius: 50%;
  padding: 4px 8px; font-size: 12px; font-weight: 900; line-height: 1; border: 2px solid var(--color-white);
}

/* =======================================================
   12) CUENTA (cuenta.html)
   ======================================================= */
.account-card{
  max-width: 560px; margin: 40px auto; background: var(--color-white);
  border: 1px solid var(--color-border-light); border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0,0,0,.06); padding: 28px; text-align: left;
}
.account-card h1{ margin: 0 0 8px 0; color: var(--color-text-dark); font-size: 26px; }
#account-status{ font-size: 13px; color: #666; margin-bottom: 8px; }
#account-status.ok{ color: #2e7d32; font-weight: 700; }

.tabs{ display: flex; gap: 10px; margin: 16px 0 18px; }
.tabs button{
  flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid #ddd;
  background: #f7f7f7; color: var(--color-text-dark); font-weight: 800; cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .05s;
}
.tabs button:hover{ background: #f0f0f0; }
.tabs button:active{ transform: translateY(1px); }
.tabs button.active{ background: var(--color-primary); border-color: var(--color-primary); color: var(--color-white); }
#tab-login, #tab-register{ margin-top: 4px; }

.account-card form{ display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 8px; }
.account-card label{ font-size: 13px; color: #666; }
.account-card input{
  width: 100%; padding: 12px 14px; border: 1px solid #ddd; border-radius: 10px; font-size: 14px;
  outline: none; transition: border-color .2s, box-shadow .2s; background: #fff;
}
.account-card input:focus{ border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(255,102,0,.12); }

.account-card .btn{
  background: var(--color-cta); color: var(--color-white); border: none; border-radius: 10px;
  padding: 12px 14px; font-weight: 800; letter-spacing: .3px; cursor: pointer; text-align: center;
  transition: background-color .2s, transform .05s, box-shadow .2s;
}
.account-card .btn:hover{ background: var(--color-cta-darker); box-shadow: 0 6px 12px rgba(0,0,0,.12); }
.account-card .btn:active{ transform: translateY(1px); }
#btn-logout{ margin-top: 6px; background: #444; }
#btn-logout:hover{ background: #222; }

.account-card .muted{ color: #777; font-size: 13px; line-height: 1.6; }
.form-note{ font-size: 12px; color: #777; }
.form-error{
  background: #ffefef; color: #b00020; border: 1px solid #ffd2d2; padding: 10px 12px; border-radius: 8px; font-size: 13px;
}
.form-success{
  background: #ecffef; color: #1b5e20; border: 1px solid #c8f0cc; padding: 10px 12px; border-radius: 8px; font-size: 13px;
}

.input-group{ position: relative; }
.input-group i{
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: #999;
}
.input-group input{ padding-left: 36px; }

/* Contraste con esquema oscuro del sistema (mantenemos carta clara) */
@media (prefers-color-scheme: dark){
  .account-card{ background: #fff; }
}

/* =======================================================
   13) UTILIDADES / EXTRAS
   ======================================================= */
.license-box {
  display: block; white-space: pre-wrap; font-family: ui-monospace, monospace;
  background: #fff; border: 1px dashed #dcdcdc; border-radius: 10px;
  padding: 10px 12px; color: #222; margin-top: 4px;
}
.license-title { font-weight: bold; font-size: 14px; margin-top: 10px; color: #333; }
.license-box code { white-space: inherit; display: block; }

.admin-separator { margin-top: 15px; border-top: 1px solid #444; padding-top: 15px; }
.admin-separator h5 { color: #FF9900; font-size: 13px; margin: 0 0 10px; padding-left: 5px; }

/* Enlaces útiles */
.footer-section p a[href^="https://wa.me"] { color: inherit; text-decoration: none; }
.logo-link a { color: #fff; text-decoration: none; }

/* El contador del carrito lo muestra JS (oculto por defecto) */
.cart-badge { display: none; }

/* Teléfono en info-contacto sin subrayado/heredando color */
.info-contacto p a[href^="tel:"] { color: inherit; text-decoration: none; }

/* =======================================================
   14) RESPONSIVE
   ======================================================= */
@media (max-width: 768px) {
  /* Layout principal */
  body { flex-direction: column; }
  .content-wrapper { height: auto; overflow-y: visible; }

  /* Sidebar horizontal sticky */
  .sidebar {
    width: 100%; height: auto; flex-direction: row; justify-content: center;
    padding: 15px 20px; background-color: var(--color-secondary);
    position: sticky; top: 0; z-index: 10;
  }
  .sidebar h2, .sidebar .info-contacto { display: none; }

  .sidebar .menu-principal ul{
    display: flex; gap: 10px 15px; flex-wrap: wrap; justify-content: center;
    padding: 0; margin: 0; list-style: none; width: 100%;
  }
  .sidebar .menu-principal a { padding: 5px; font-size: 13px; position: relative; }

  /* Badge menor en enlaces */
  .cart-badge { position: absolute; top: 2px; right: -10px; }

  /* Hero/Banner */
  .banner { padding: 60px 20px; }
  .banner h1 { font-size: 32px; }

  /* Secciones */
  .productos, .cart-page-content, .checkout-content { padding: 20px; }

  /* Grid productos: 2 por fila */
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }

  /* Carrito: columnas apiladas */
  .cart-header, .cart-item { grid-template-columns: 1fr 1fr; row-gap: 5px; padding: 10px 0; }
  .cart-header div:nth-child(2),
  .cart-header div:nth-child(3),
  .cart-header div:nth-child(4),
  .cart-header div:nth-child(5) { display: none; }

  .cart-item .item-name { grid-column: 1 / 3; text-align: left; }
  .cart-item .item-price { grid-column: 1; text-align: left; font-weight: bold; }
  .cart-item .item-quantity {
    grid-column: 2; justify-content: flex-end; width: auto; margin: 0; border: none;
  }
  .cart-item .item-quantity span { border-top: 1px solid #eee; border-bottom: 1px solid #eee; }
  .cart-item .item-subtotal { display: none; }
  .btn-remove { grid-column: 2; grid-row: 1; margin: 0; justify-self: flex-end; }

  /* Footer */
  .main-footer { flex-direction: column; padding: 20px; }

  /* Resumen carrito */
  .cart-summary { width: 100%; margin: 20px auto; padding: 20px; }
  .cart-summary .summary-line { width: 100%; }
  .cart-summary .total-line { font-size: 20px; }

  /* Detalle de producto */
  .product-detail-container { flex-direction: column; max-width: 100%; margin: 20px; padding: 20px; }
  .product-image-column { width: 100% !important; flex-basis: 100% !important; padding: 0; margin: 0; text-align: center; flex-basis: auto; }
  #product-detail-image { width: 100% !important; max-width: 100% !important; height: auto; display: block; }

  /* Checkout adaptado */
  .checkout-layout { flex-direction: column; gap: 30px; }
  .order-summary-block, .payment-instructions-block { min-width: unset; width: 100%; }
  .checkout-box { padding: 30px 20px; }
  .checkout-box > p { font-size: 16px; }
  #final-total { font-size: 38px; }
  .btn-checkout { padding: 15px 20px; font-size: 16px; }
  .payment-instructions { margin-top: 0; }
}

@media (max-width: 500px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .checkout-box { margin: 20px; }
  /* Badges más pequeños */
  .product-card .soldout-badge,
  .product-card .available-badge{
    top: 4px; left: 4px; padding: 3px 7px; font-size: 10px;
  }
}

@media (max-width: 576px) {
  .main-content { padding: 20px 10px; }
  .checkout-box { padding: 20px; border-radius: 12px; }
  h1 { font-size: 26px; }
  h2 { font-size: 20px; }
  #final-total { font-size: 36px; }
  .payment-method { padding: 12px 15px; }
}
