/* ── JGV MOTORCYCLE TIENDA ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #e63946;
  --primary-dark: #c1121f;
  --secondary: #1d3557;
  --accent: #457b9d;
  --bg: #f8f9fa;
  --bg2: #ffffff;
  --text: #212529;
  --text2: #495057;
  --text3: #6c757d;
  --border: #dee2e6;
  --shadow: 0 2px 12px rgba(0,0,0,0.1);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.15);
  --radius: 12px;
  --radius-sm: 8px;
}
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); }
a { text-decoration: none; color: inherit; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* ── HEADER ── */
.header { position: sticky; top: 0; z-index: 100; background: #fff; box-shadow: var(--shadow); }
.header-top { background: var(--secondary); color: #fff; padding: 6px 0; font-size: 12px; }
.header-top .container { display: flex; justify-content: space-between; align-items: center; }
.header-main { padding: 12px 0; }
.header-inner { display: flex; align-items: center; gap: 20px; }
.logo img { height: 48px; object-fit: contain; }
.search-box { flex: 1; position: relative; display: flex; gap: 0; }
.search-box input { flex: 1; padding: 12px 16px; border: 2px solid var(--border); border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); font-size: 14px; outline: none; transition: border 0.2s; }
.search-box input:focus { border-color: var(--primary); }
.search-box button { padding: 12px 24px; background: var(--primary); color: #fff; border: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; cursor: pointer; font-weight: 600; font-size: 14px; transition: background 0.2s; }
.search-box button:hover { background: var(--primary-dark); }
#btn-mic { background: #fff !important; color: var(--primary); border-top: 2px solid var(--border) !important; border-bottom: 2px solid var(--border) !important; border-left: none !important; border-right: none !important; padding: 12px 14px !important; font-size: 16px; border-radius: 0 !important; }
#btn-mic:hover { background: #f5f5f5 !important; }
#btn-mic.mic-activo { background: #ffe3e3 !important; color: #e63946; animation: pulso-mic 1s infinite; }
@keyframes pulso-mic { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.search-dropdown { position: absolute; top: 100%; left: 0; right: 60px; background: #fff; border: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); box-shadow: var(--shadow); z-index: 200; max-height: 400px; overflow-y: auto; display: none; }
.search-dropdown.active { display: block; }
.search-item { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.search-item:hover { background: var(--bg); }
.search-item-name { font-size: 13px; font-weight: 500; }
.search-item-price { font-size: 13px; font-weight: 700; color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.btn-icon { background: none; border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 10px 16px; cursor: pointer; font-size: 16px; position: relative; transition: all 0.2s; }
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }
.cart-badge { background: var(--primary); color: #fff; border-radius: 50%; padding: 2px 6px; font-size: 11px; font-weight: 700; }
.btn-whatsapp { background: #25d366; color: #fff; padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; white-space: nowrap; transition: background 0.2s; }
.btn-whatsapp:hover { background: #128c7e; }

/* ── NAV CATEGORÍAS ── */
.nav-categorias { background: var(--secondary); padding: 0; }
.nav-scroll { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; }
.nav-scroll::-webkit-scrollbar { display: none; }
.nav-cat-btn { padding: 12px 20px; color: rgba(255,255,255,0.8); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; border: none; background: none; transition: all 0.2s; border-bottom: 3px solid transparent; }
.nav-cat-btn:hover, .nav-cat-btn.active { color: #fff; border-bottom-color: var(--primary); background: rgba(255,255,255,0.1); }
.nav-categorias .container { display: flex; align-items: center; gap: 8px; }
.nav-scroll { flex: 1; min-width: 0; }
#nav-cat-select { flex-shrink: 0; padding: 7px 10px; border-radius: 8px; border: 1.5px solid rgba(255,255,255,.3); background: var(--secondary); color: #fff; font-size: 12px; cursor: pointer; max-width: 150px; }
#btn-ver-todas-nav { flex-shrink: 0; padding: 7px 12px; border-radius: 8px; border: none; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.cat-modal-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; color: #1d3557; transition: background 0.15s; }
.cat-modal-item:hover { background: #f0f7fb; }
.cat-modal-count { font-size: 12px; color: #888; background: #f0f0f0; padding: 2px 8px; border-radius: 10px; }
@media (max-width: 768px) { #nav-cat-select { display: none; } }

/* ── BANNER ── */
.banner { background: linear-gradient(135deg, var(--secondary) 0%, #2d6a9f 100%); color: #fff; padding: 60px 0; }
.banner-content { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.banner-text h1 { font-size: 42px; font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.banner-text p { font-size: 16px; color: rgba(255,255,255,0.8); margin-bottom: 28px; line-height: 1.6; }
.banner-btns { display: flex; gap: 16px; flex-wrap: wrap; }
.btn-primary { background: var(--primary); color: #fff; padding: 14px 28px; border-radius: var(--radius-sm); font-weight: 700; font-size: 15px; border: none; cursor: pointer; transition: all 0.2s; display: inline-block; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 4px 15px rgba(230,57,70,0.4); }
.btn-secondary { background: rgba(255,255,255,0.15); color: #fff; padding: 14px 28px; border-radius: var(--radius-sm); font-weight: 600; font-size: 15px; border: 2px solid rgba(255,255,255,0.3); display: inline-block; transition: all 0.2s; }
.btn-secondary:hover { background: rgba(255,255,255,0.25); }
.banner-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-card { background: rgba(255,255,255,0.15); border-radius: var(--radius); padding: 20px; text-align: center; backdrop-filter: blur(10px); }
.stat-num { font-size: 28px; font-weight: 800; color: #fff; }
.stat-label { font-size: 13px; color: rgba(255,255,255,0.7); margin-top: 4px; }

/* ── SECCIONES ── */
.section-cats, .section-productos { padding: 48px 0; }
.section-title { font-size: 28px; font-weight: 800; color: var(--secondary); margin-bottom: 28px; position: relative; padding-bottom: 12px; }
.section-title::after { content: ''; position: absolute; bottom: 0; left: 0; width: 60px; height: 4px; background: var(--primary); border-radius: 2px; }

/* ── CATEGORÍAS GRID ── */
.cats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.cat-card { background: #fff; border-radius: var(--radius); padding: 24px 16px; text-align: center; cursor: pointer; transition: all 0.2s; border: 2px solid transparent; box-shadow: var(--shadow); }
.cat-card:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.cat-icon { font-size: 36px; margin-bottom: 10px; }
.cat-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.cat-count { font-size: 11px; color: var(--text3); }

/* ── PRODUCTOS GRID ── */
.productos-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.filtros { display: flex; gap: 10px; }
.filtros select { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: #fff; cursor: pointer; outline: none; }
.productos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.producto-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: all 0.25s; cursor: pointer; border: 1px solid var(--border); }
.producto-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); border-color: var(--primary); }
.producto-img { width: 100%; height: 200px; object-fit: contain; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 48px; padding: 8px; }
.producto-img img { width: 100%; height: 200px; object-fit: contain; padding: 8px; }
.producto-body { padding: 14px; }
.producto-cat { font-size: 10px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.producto-nombre { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; line-height: 1.4; height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.producto-ref { font-size: 11px; color: var(--text3); margin-bottom: 8px; font-family: monospace; }
.producto-precio { font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.producto-stock { font-size: 11px; margin-bottom: 12px; }
.stock-ok { color: #2d6a4f; font-weight: 600; }
.stock-bajo { color: #e76f51; font-weight: 600; }
.stock-no { color: #e63946; font-weight: 600; }
.btn-agregar { width: 100%; padding: 10px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 700; font-size: 13px; cursor: pointer; transition: background 0.2s; }
.btn-agregar:hover { background: var(--primary-dark); }
.btn-agregar:disabled { background: #adb5bd; cursor: not-allowed; }
.loading-productos { text-align: center; padding: 60px; color: var(--text3); font-size: 16px; grid-column: 1/-1; }

/* ── PAGINACIÓN ── */
.paginacion { display: flex; justify-content: center; gap: 8px; margin-top: 32px; flex-wrap: wrap; }
.pag-btn { padding: 10px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.pag-btn:hover, .pag-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── CARRITO ── */
.carrito-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 300; display: none; }
.carrito-overlay.active { display: block; }
.carrito-sidebar { position: fixed; right: -420px; top: 0; bottom: 0; width: 420px; background: #fff; z-index: 301; transition: right 0.3s; display: flex; flex-direction: column; box-shadow: -4px 0 30px rgba(0,0,0,0.15); }
.carrito-sidebar.active { right: 0; }
.carrito-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.carrito-header h3 { font-size: 18px; font-weight: 700; }
.carrito-header button { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text3); }
.carrito-items { flex: 1; overflow-y: auto; padding: 16px; }
.carrito-vacio { text-align: center; padding: 60px 20px; color: var(--text3); }
.carrito-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: center; }
.carrito-item-img { width: 60px; height: 60px; background: var(--bg); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.carrito-item-info { flex: 1; min-width: 0; }
.carrito-item-nombre { font-size: 13px; font-weight: 600; margin-bottom: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.carrito-item-precio { font-size: 14px; font-weight: 700; color: var(--primary); }
.carrito-item-controls { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.carrito-item-controls button { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 4px; background: #fff; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.carrito-item-qty { font-size: 14px; font-weight: 600; min-width: 24px; text-align: center; }
.carrito-item-delete { background: none; border: none; color: #e63946; cursor: pointer; font-size: 16px; padding: 4px; }
.carrito-footer { padding: 20px; border-top: 1px solid var(--border); background: var(--bg); }
.carrito-total { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.btn-checkout { width: 100%; padding: 14px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 700; font-size: 15px; cursor: pointer; margin-top: 12px; transition: background 0.2s; }
.btn-checkout:hover { background: var(--primary-dark); }
.btn-whatsapp-order { width: 100%; padding: 12px; background: #25d366; color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 700; font-size: 14px; cursor: pointer; margin-top: 8px; }

/* ── MODAL PRODUCTO ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 400; display: none; }
.modal-overlay.active { display: block; }
.modal-producto { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9); background: #fff; border-radius: var(--radius); z-index: 401; width: 90%; max-width: 700px; max-height: 85vh; overflow-y: auto; transition: transform 0.2s; display: none; }
.modal-producto.active { display: block; transform: translate(-50%, -50%) scale(1); }
.modal-close { position: sticky; top: 16px; left: calc(100% - 50px); background: var(--text); color: #fff; border: none; border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 16px; z-index: 1; display: block; margin: 16px 16px 0 auto; }
.modal-content { padding: 24px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.modal-img { background: var(--bg); border-radius: var(--radius); height: 280px; display: flex; align-items: center; justify-content: center; font-size: 80px; }
.modal-info h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.modal-ref { font-size: 12px; color: var(--text3); font-family: monospace; margin-bottom: 12px; }
.modal-precio { font-size: 32px; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.modal-precio2 { font-size: 16px; color: var(--text3); text-decoration: line-through; margin-bottom: 12px; }
.modal-stock-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; margin-bottom: 16px; }
.modal-qty { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-qty button { width: 36px; height: 36px; border: 2px solid var(--border); border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-size: 18px; font-weight: 700; }
.modal-qty span { font-size: 18px; font-weight: 700; min-width: 36px; text-align: center; }
.modal-detalles { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.modal-detalle-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--bg); }
.modal-detalle-row span:first-child { color: var(--text3); }
.modal-detalle-row span:last-child { font-weight: 600; }

/* ── WHATSAPP FLOTANTE ── */
.whatsapp-float { position: fixed; bottom: 24px; right: 24px; background: #25d366; color: #fff; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(37,211,102,0.5); z-index: 200; transition: transform 0.2s; }
.whatsapp-float:hover { transform: scale(1.1); }
.whatsapp-float svg { width: 32px; height: 32px; }

/* ── FOOTER ── */
.footer { background: var(--secondary); color: rgba(255,255,255,0.8); padding: 60px 0 0; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer h4 { color: #fff; font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.footer p { font-size: 13px; line-height: 1.8; }
.footer a { display: block; font-size: 13px; color: rgba(255,255,255,0.7); margin-bottom: 8px; transition: color 0.2s; }
.footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding: 20px 0; text-align: center; font-size: 12px; }
.social-links { display: flex; gap: 12px; margin-top: 12px; }
.social-links a { display: inline-block; background: rgba(255,255,255,0.1); padding: 8px 16px; border-radius: 20px; font-size: 12px; color: #fff; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .banner-content { grid-template-columns: 1fr; }
  .banner-text h1 { font-size: 28px; }
  .banner-stats { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .header-top .container { flex-direction: column; gap: 4px; text-align: center; }
  .carrito-sidebar { width: 100%; right: -100%; }
  .productos-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .header-inner { flex-wrap: wrap; }
  .search-box { order: 3; width: 100%; }
}

/* ── Vista Lista ── */
.productos-grid.vista-lista {
  grid-template-columns: 1fr !important;
  gap: 10px;
}
.productos-grid.vista-lista .producto-card {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
}
.productos-grid.vista-lista .producto-img {
  width: 120px;
  height: 120px;
  min-height: unset;
}
.productos-grid.vista-lista .producto-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.productos-grid.vista-lista .producto-nombre {
  font-size: 15px;
  -webkit-line-clamp: 2;
}
.productos-grid.vista-lista .producto-precio {
  font-size: 18px;
}
.productos-grid.vista-lista .btn-agregar {
  align-self: center;
  margin: 0 16px;
  width: 120px;
  white-space: nowrap;
}
@media(max-width:600px) {
  .productos-grid.vista-lista .producto-card {
    grid-template-columns: 90px 1fr;
  }
  .productos-grid.vista-lista .btn-agregar {
    grid-column: 1/-1;
    margin: 0 12px 12px;
    width: auto;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
