/* ===== AgroRed Perú — estilos ===== */
:root {
  /* Paleta de marca AgroRed: azul marino + naranja */
  --verde: #16365c;
  --verde-oscuro: #0e2440;
  --verde-claro: #e9eff7;
  --naranja: #f26c22;
  --rojo-oferta: #e53935;
  --gris-fondo: #f5f6f8;
  --gris-texto: #555;
  --borde: #e2e5e9;
  --radio: 10px;
  --sombra: 0 2px 10px rgba(0,0,0,.07);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--gris-fondo); color: #222; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Topbar */
.topbar { background: var(--verde-oscuro); color: #fff; font-size: 13px; padding: 6px 0; }
.topbar-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.topbar a { text-decoration: underline; }
.topbar-promo { opacity: .9; }

/* Header */
.header { background: #fff; box-shadow: var(--sombra); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 20px; padding: 14px 16px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 26px; font-weight: 800; color: var(--verde); white-space: nowrap; }
.logo-img { height: 42px; width: auto; object-fit: contain; }
.logo-accent { color: var(--naranja); }
.logo-text small { font-size: 10px; letter-spacing: 2.5px; color: var(--gris-texto); display: block; margin-top: 3px; line-height: 1; }
.search-wrap { flex: 1; position: relative; }
.search-box { display: flex; border: 2px solid var(--verde); border-radius: 30px; overflow: hidden; }

/* Sugerencias de búsqueda en vivo */
.sugerencias { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--borde); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 80; max-height: 430px; overflow-y: auto; }
.sug-item { display: flex; align-items: center; gap: 12px; padding: 9px 14px; cursor: pointer; border-bottom: 1px solid #f0f2f5; }
.sug-item:hover { background: var(--verde-claro); }
.sug-item .sug-img { width: 46px; height: 46px; flex: none; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--borde); border-radius: 8px; padding: 3px; }
.sug-item .sug-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sug-item .sug-img svg { width: 26px; height: 26px; color: #b9c4d0; }
.sug-info { flex: 1; min-width: 0; }
.sug-nombre { font-size: 14px; font-weight: 600; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-marca { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.sug-precio { font-weight: 800; color: var(--verde); font-size: 14px; white-space: nowrap; }
.sug-precio.consultar { color: var(--naranja); font-size: 12px; }
.sug-todos { display: block; text-align: center; padding: 11px; font-size: 13px; font-weight: 700; color: var(--verde); background: #f8fafc; }
.sug-todos:hover { background: var(--verde-claro); }
.sug-vacio { padding: 16px; text-align: center; color: var(--gris-texto); font-size: 14px; }
.search-box input { flex: 1; border: none; padding: 10px 18px; font-size: 15px; outline: none; }
.search-box button { border: none; background: var(--verde); color: #fff; padding: 0 22px; font-size: 17px; cursor: pointer; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.cart-btn { position: relative; font-size: 24px; display: flex; align-items: center; gap: 6px; }
.cart-label { font-size: 14px; font-weight: 600; color: var(--verde); }
.cart-count { position: absolute; top: -8px; left: 16px; background: var(--rojo-oferta); color: #fff; font-size: 11px; font-weight: 700; border-radius: 50%; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* Nav */
.mainnav { background: var(--verde); }
.mainnav-list { display: flex; flex-wrap: wrap; }
.mainnav-list a { display: block; padding: 11px 15px; color: #fff; font-size: 14px; font-weight: 600; transition: background .15s; }
.mainnav-list a:hover, .mainnav-list a.activo { background: var(--verde-oscuro); }

/* Main */
main { min-height: 60vh; padding: 24px 16px 48px; }

/* Hero */
.hero { background: linear-gradient(120deg, var(--verde-oscuro) 0%, var(--verde) 55%, #2c5585 100%); border-radius: var(--radio); color: #fff; padding: 48px 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.hero-flyer { max-width: 340px; border-radius: var(--radio); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.hero h1 { font-size: 36px; line-height: 1.15; margin-bottom: 12px; }
.hero p { font-size: 17px; opacity: .92; margin-bottom: 22px; max-width: 480px; }
.hero-emoji { font-size: 110px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.25)); }
.btn { display: inline-block; background: var(--naranja); color: #fff; font-weight: 700; padding: 12px 28px; border-radius: 30px; border: none; font-size: 15px; cursor: pointer; transition: transform .1s, filter .15s; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-verde { background: var(--verde); }
.btn-borde { background: #fff; color: var(--verde); border: 2px solid var(--verde); }
.btn-block { display: block; width: 100%; text-align: center; }

/* Secciones */
.seccion { margin-bottom: 40px; }
.seccion-titulo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.seccion-titulo h2 { font-size: 24px; color: #1a1a1a; }
.seccion-titulo h2 span { color: var(--naranja); }
.ver-todo { color: var(--verde); font-weight: 600; font-size: 14px; }

/* Categorías grid */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.cat-card { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 20px 10px; text-align: center; transition: box-shadow .15s, transform .15s; }
.cat-card:hover { box-shadow: var(--sombra); transform: translateY(-3px); }
.cat-card .icono { display: block; margin: 0 auto 10px; width: 46px; height: 46px; color: var(--verde); transition: color .15s; }
.cat-card .icono svg { width: 100%; height: 100%; }
.cat-card:hover .icono { color: var(--naranja); }
.cat-card .nombre { font-size: 13px; font-weight: 700; color: #333; }

/* Filtros por marca y orden */
.filtros { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px 16px; margin-bottom: 18px; }
.filtros-label { font-size: 13px; font-weight: 700; color: var(--gris-texto); margin-right: 4px; }
.chip { display: inline-block; padding: 7px 16px; border-radius: 20px; border: 1.5px solid var(--borde); font-size: 13px; font-weight: 600; color: #444; transition: all .15s; }
.chip:hover { border-color: var(--verde); color: var(--verde); }
.chip.activo { background: var(--verde); border-color: var(--verde); color: #fff; }
.orden { margin-left: auto; padding: 8px 12px; border: 1.5px solid var(--borde); border-radius: 8px; font-size: 13px; font-weight: 600; color: #444; outline: none; cursor: pointer; background: #fff; }

/* Productos grid */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.prod-card { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; position: relative; }
.prod-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.12); transform: translateY(-3px); }
.prod-badge { position: absolute; top: 10px; left: 10px; background: var(--rojo-oferta); color: #fff; font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 20px; z-index: 2; }
.prod-badge.nuevo { background: var(--verde); }
.prod-badge.pro { background: #37474f; }
.prod-desc-badge { position: absolute; top: 10px; right: 10px; background: var(--naranja); color: #fff; font-size: 12px; font-weight: 800; padding: 4px 8px; border-radius: 6px; z-index: 2; }
.prod-img { height: 180px; display: flex; align-items: center; justify-content: center; background: #fff; padding: 12px; }
.prod-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.icono-fallback { display: block; width: 84px; height: 84px; color: #b9c4d0; }
.icono-fallback svg { width: 100%; height: 100%; }
.ficha-img .icono-fallback { width: 150px; height: 150px; }
.mini-img .icono-fallback { width: 40px; height: 40px; }
.prod-info { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.prod-marca { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.prod-nombre { font-size: 15px; font-weight: 600; line-height: 1.3; margin-bottom: 10px; flex: 1; color: #222; }
.prod-precios { margin-bottom: 12px; }
.precio-antes { color: #999; text-decoration: line-through; font-size: 13px; margin-right: 8px; }
.precio { color: var(--verde); font-size: 20px; font-weight: 800; }
.precio.consultar { color: var(--naranja); font-size: 16px; }
.prod-card .btn { padding: 10px 0; font-size: 14px; border-radius: 8px; }

/* Banner marcas */
.marcas { display: flex; gap: 16px; flex-wrap: wrap; }
.marca-chip { flex: 1; min-width: 220px; background: #fff; border-radius: var(--radio); border: 1px solid var(--borde); padding: 24px; text-align: center; font-size: 26px; font-weight: 900; letter-spacing: 1px; }

/* Ficha de producto */
.ficha { background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 32px; display: grid; grid-template-columns: 1fr 1.2fr; gap: 36px; }
.ficha-img { display: flex; align-items: center; justify-content: center; font-size: 150px; background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); min-height: 320px; padding: 20px; }
.ficha-img img { max-width: 100%; max-height: 420px; object-fit: contain; }
.ficha-sku { font-size: 13px; color: var(--gris-texto); margin-bottom: 6px; }
.ficha-info .prod-marca { font-size: 13px; }
.ficha-info h1 { font-size: 28px; margin-bottom: 12px; }
.ficha-info .prod-precios { margin: 16px 0; }
.ficha-info .precio { font-size: 30px; }
.ficha-info .precio-antes { font-size: 17px; }
.ficha-desc { color: var(--gris-texto); line-height: 1.6; margin-bottom: 18px; }
.ficha-specs { background: var(--verde-claro); border-radius: 8px; padding: 16px 20px; margin-bottom: 22px; }
.ficha-specs li { padding: 4px 0; font-size: 14px; }
.ficha-specs li::before { content: "✓ "; color: var(--verde); font-weight: 700; }
.ficha-acciones { display: flex; gap: 12px; flex-wrap: wrap; }
.cantidad { display: flex; align-items: center; border: 2px solid var(--borde); border-radius: 8px; overflow: hidden; }
.cantidad button { border: none; background: #f0f0f0; width: 38px; height: 44px; font-size: 18px; cursor: pointer; }
.cantidad input { width: 50px; text-align: center; border: none; font-size: 16px; font-weight: 700; outline: none; }
.miga { font-size: 13px; color: var(--gris-texto); margin-bottom: 18px; }
.miga a { color: var(--verde); font-weight: 600; }

/* Carrito */
.carrito-layout { display: grid; grid-template-columns: 1.8fr 1fr; gap: 24px; align-items: start; }
.carrito-lista, .resumen { background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 24px; }
.carrito-item { display: grid; grid-template-columns: 70px 1fr auto auto auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--borde); }
.carrito-item:last-child { border-bottom: none; }
.carrito-item .mini-img { font-size: 40px; text-align: center; background: #fff; border: 1px solid var(--borde); border-radius: 8px; padding: 4px; height: 66px; display: flex; align-items: center; justify-content: center; }
.carrito-item .mini-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.carrito-item .nombre { font-weight: 600; font-size: 14px; }
.carrito-item .marca { font-size: 12px; color: var(--gris-texto); }
.carrito-item .subtotal { font-weight: 800; color: var(--verde); }
.quitar { background: none; border: none; color: var(--rojo-oferta); cursor: pointer; font-size: 18px; }
.resumen h3 { margin-bottom: 16px; }
.resumen-linea { display: flex; justify-content: space-between; padding: 8px 0; font-size: 15px; }
.resumen-total { border-top: 2px solid var(--borde); margin-top: 8px; padding-top: 14px; font-size: 19px; font-weight: 800; }
.resumen .btn { margin-top: 16px; }
.vacio { text-align: center; padding: 60px 20px; background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); }
.vacio .icono { font-size: 70px; display: block; margin-bottom: 12px; }
.vacio p { color: var(--gris-texto); margin: 10px 0 20px; }

/* Checkout */
.checkout-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
.form-card { background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 28px; }
.form-card h3 { margin-bottom: 18px; color: var(--verde); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.campo label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; color: #444; }
.campo input, .campo select, .campo textarea { width: 100%; padding: 11px 12px; border: 1.5px solid var(--borde); border-radius: 8px; font-size: 14px; outline: none; font-family: inherit; }
.campo input:focus, .campo select:focus { border-color: var(--verde); }
.metodos-pago { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.metodo { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--borde); border-radius: 8px; padding: 12px 14px; cursor: pointer; font-size: 14px; }
.metodo:has(input:checked) { border-color: var(--verde); background: var(--verde-claro); }
.nota-proto { font-size: 12px; color: var(--gris-texto); margin-top: 10px; }

/* Confirmación */
.confirmacion { text-align: center; background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 60px 24px; max-width: 620px; margin: 0 auto; }
.confirmacion .icono { font-size: 80px; display: block; margin-bottom: 14px; }
.confirmacion h1 { color: var(--verde); margin-bottom: 10px; }
.confirmacion p { color: var(--gris-texto); margin-bottom: 8px; }
.codigo-pedido { display: inline-block; background: var(--verde-claro); color: var(--verde); font-weight: 800; font-size: 20px; padding: 10px 24px; border-radius: 8px; margin: 16px 0 24px; }

/* Footer */
.footer { background: var(--verde-oscuro); color: #cfe4d1; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 28px; padding: 40px 16px 24px; }
.footer h4 { color: #fff; margin-bottom: 12px; font-size: 16px; }
.footer li { padding: 4px 0; font-size: 14px; }
.footer a:hover { color: #fff; text-decoration: underline; }
.footer p { font-size: 14px; line-height: 1.6; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); text-align: center; padding: 16px; font-size: 13px; }

/* WhatsApp flotante */
.whatsapp-float { position: fixed; bottom: 22px; right: 22px; background: #25d366; width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.3); z-index: 100; transition: transform .15s; }
.whatsapp-float:hover { transform: scale(1.08); }

/* Toast */
.toast { position: fixed; bottom: 95px; right: 22px; background: #222; color: #fff; padding: 13px 22px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; transform: translateY(8px); z-index: 200; }
.toast.visible { opacity: 1; transform: translateY(0); }

/* Responsive */
@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; }
  .search-box { order: 3; width: 100%; flex: none; }
  .hero { flex-direction: column; text-align: center; padding: 36px 20px; }
  .hero p { margin-left: auto; margin-right: auto; }
  .hero-emoji { font-size: 80px; }
  .ficha, .carrito-layout, .checkout-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .carrito-item { grid-template-columns: 60px 1fr auto; grid-template-rows: auto auto; }
  .topbar-promo { display: none; }
}
