/* =====================================================
   Ajustes de tarjetas de producto: simetría y centrado
   ===================================================== */

/* Todas las tarjetas de una fila con la misma altura */
.grid > .product-card { height: 100%; }

/* Imagen centrada y completa (sin recortes), sobre fondo blanco */
.product-media {
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.product-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 18px;
}

/* Nombre: reserva siempre 2 líneas para que todo quede alineado */
.product-body h3 {
    min-height: 2.3em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Serie: ocupa siempre el mismo espacio, tenga o no valor */
.product-body p.product-serie {
    flex: 0 0 auto;
    min-height: 1.5em;
    margin: 0 0 4px;
    font-size: .88rem;
    color: var(--steel);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.product-body p.product-serie strong { color: var(--ink); font-weight: 600; }

/* Precio y botón siempre al fondo de la tarjeta, a la misma altura */
.product-footer { margin-top: auto; }

/* Botones de WhatsApp: ícono y texto centrados y alineados */
.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    line-height: 1;
    white-space: nowrap;
}
.btn-whatsapp svg { display: block; width: 18px; height: 18px; }
.product-info .btn-whatsapp { gap: 10px; padding: 14px 24px !important; }
.product-info .btn-whatsapp svg { width: 20px; height: 20px; }

/* =====================================================
   Catálogo: categorías a la izquierda + buscador
   ===================================================== */
.catalogo {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 34px;
    align-items: start;
}
.catalogo-lateral {
    position: sticky;
    top: 104px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.catalogo-contenido .grid-3 { grid-template-columns: repeat(3, 1fr); gap: 22px; }

/* Buscador */
.buscador { position: relative; margin: 0; }
.buscador-titulo { font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 1.05rem; color: var(--navy-dark); margin-bottom: 10px; display: block; }
.buscador-campo {
    display: flex; align-items: center;
    border: 1px solid var(--line); background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.buscador-campo:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(42,72,163,.12); }
.buscador-campo svg { width: 18px; height: 18px; color: var(--steel); margin-left: 12px; flex-shrink: 0; }
.buscador form input, .buscador-campo input[type="search"] {
    border: none !important; box-shadow: none !important; outline: none;
    padding: 12px 10px; font-size: .92rem; width: 100%; min-width: 0; background: transparent;
}
.buscador-campo button {
    border: none; background: var(--navy); color: #fff; cursor: pointer;
    font-family: 'Oswald', sans-serif; font-weight: 600; font-size: .85rem;
    padding: 0 14px; align-self: stretch; transition: background .2s ease;
}
.buscador-campo button:hover { background: var(--blue); }

/* Vista previa de resultados */
.buscador-resultados {
    position: absolute; left: 0; top: 100%; margin-top: 6px; z-index: 50;
    width: max(100%, 360px);
    background: #fff; border: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(12,28,80,.16);
    max-height: 70vh; overflow-y: auto;
    animation: brAparecer .18s ease;
}
@keyframes brAparecer { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.br-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; color: var(--ink);
    border-bottom: 1px solid var(--line);
}
.br-item:hover, .br-item.activo { background: var(--bg-soft); }
.br-item img, .br-sinimg { width: 48px; height: 48px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex-shrink: 0; }
.br-texto { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.br-texto strong { font-size: .88rem; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-texto small { font-size: .78rem; color: var(--steel); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-texto mark { background: #FFF1B8; color: inherit; padding: 0 1px; }
.br-precio { font-family: 'Oswald', sans-serif; font-weight: 600; color: var(--navy-dark); font-size: .9rem; white-space: nowrap; }
.br-vacio { padding: 16px; font-size: .88rem; color: var(--steel); }
.br-todos {
    display: block; width: 100%; padding: 11px; border: none; cursor: pointer;
    background: #fff; color: var(--blue); font-weight: 600; font-size: .85rem; text-align: center;
}
.br-todos:hover { background: var(--bg-soft); }

/* Lista de categorías */
.categorias-lista { background: #fff; border: 1px solid var(--line); }
.categorias-lista h4 {
    margin: 0; padding: 14px 18px; font-size: 1.05rem;
    background: var(--navy-dark); color: #fff;
}
.categorias-lista ul { list-style: none; margin: 0; padding: 6px 0; }
.categorias-lista a {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 18px; color: var(--ink); font-size: .92rem; font-weight: 500;
    border-left: 3px solid transparent;
    transition: background .2s ease, border-color .2s ease, color .2s ease, padding .2s ease;
}
.categorias-lista a:hover { background: var(--bg-soft); color: var(--blue); padding-left: 22px; }
.categorias-lista a.active { border-left-color: var(--blue); background: #EEF1FA; color: var(--navy-dark); font-weight: 600; }
.categorias-lista em {
    font-style: normal; font-size: .75rem; font-weight: 600; color: var(--steel);
    background: var(--bg-soft); padding: 2px 8px; min-width: 26px; text-align: center;
}
.categorias-lista a.active em { background: var(--navy); color: #fff; }

/* Mensaje de resultados de búsqueda */
.busqueda-info {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; margin-bottom: 20px;
    background: #EEF1FA; border-left: 4px solid var(--blue); font-size: .92rem;
}
.busqueda-info a { font-weight: 600; font-size: .85rem; }

@media (max-width: 1100px) {
    .catalogo-contenido .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
    .catalogo { grid-template-columns: 1fr; gap: 24px; }
    .catalogo-lateral { position: static; }
    .categorias-lista ul { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; }
    .categorias-lista a { border: 1px solid var(--line); padding: 7px 12px; }
    .categorias-lista a:hover { padding-left: 12px; }
    .categorias-lista a.active { border-color: var(--blue); }
    .buscador-resultados { width: 100%; }
}
@media (max-width: 560px) {
    .catalogo-contenido .grid-3 { grid-template-columns: 1fr; }
}

/* Corrección: la vista previa del buscador siempre por encima de las tarjetas */
.catalogo-lateral { z-index: 30; }
.catalogo-contenido { position: relative; z-index: 1; }
.buscador-resultados { z-index: 60; }

/* Nosotros: ilustración del electricista */
.nosotros-ilustracion img { width: 100%; height: auto; max-width: 560px; margin: 0 auto; }
@keyframes jtFlotar { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.nosotros-ilustracion img { animation: jtFlotar 6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .nosotros-ilustracion img { animation: none; } }


/* Precio oculto: "Consultar precio" */
.product-price.precio-consultar { font-size: .95rem; color: var(--blue); }
.product-detail-price.precio-consultar { font-size: 1.35rem; color: var(--blue); }

/* Catálogo: transición al cambiar de categoría sin recargar */
.catalogo-contenido { transition: opacity .18s ease; }
.catalogo-contenido.cat-cargando { opacity: .45; pointer-events: none; }
@keyframes catAparecer { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.catalogo-contenido.cat-aparecer { animation: catAparecer .35s ease both; }
@media (prefers-reduced-motion: reduce) { .catalogo-contenido.cat-aparecer { animation: none; } }

/* =====================================================
   Botón de compartir (solo ícono) junto a WhatsApp
   ===================================================== */
.card-acciones { display: inline-flex; align-items: stretch; gap: 8px; }
.product-footer { gap: 10px; }
.btn-compartir {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; min-height: 38px; padding: 0; flex-shrink: 0;
    border: 1.5px solid var(--line); background: #fff; color: var(--navy);
    cursor: pointer; transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.btn-compartir svg { width: 18px; height: 18px; pointer-events: none; }
.btn-compartir:hover, .btn-compartir[aria-expanded="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-compartir:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn-compartir-lg { width: 52px; }
.btn-compartir-lg svg { width: 22px; height: 22px; }
.producto-acciones { display: flex; align-items: stretch; gap: 10px; margin-top: 10px; }

.compartir-menu {
    position: absolute; z-index: 500; min-width: 210px;
    background: #fff; border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(12,28,80,.18);
    padding: 6px 0; animation: brAparecer .16s ease;
}
.compartir-menu a, .compartir-menu button {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px;
    border: none; background: none; color: var(--ink); font: inherit; font-size: .92rem; font-weight: 500;
    text-align: left; cursor: pointer;
}
.compartir-menu a:hover, .compartir-menu button:hover { background: var(--bg-soft); }
.compartir-menu svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--navy); }
.compartir-menu .compartir-copiar { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px; }

@media (max-width: 380px) {
    .product-footer .card-acciones { width: 100%; }
    .product-footer .card-acciones .btn-whatsapp { flex: 1; }
}
.product-price { white-space: nowrap; }
/* Tarjetas angostas: precio arriba y botones (WhatsApp + compartir) abajo, a todo el ancho */
.product-card { container-type: inline-size; }
@container (max-width: 330px) {
    .product-footer { flex-direction: column; align-items: stretch; }
    .product-footer .card-acciones { width: 100%; }
    .product-footer .card-acciones .btn-whatsapp { flex: 1; }
}


/* =====================================================
   Pie de página (sin categorías, más ordenado)
   ===================================================== */
footer .footer-grid.footer-grid-v2 { grid-template-columns: 1.4fr 1fr 1.2fr auto; gap: 48px; align-items: start; }
.footer-logo { display: inline-block; margin-bottom: 14px; }
.footer-logo img { height: 96px; width: auto; }
.footer-marca p { max-width: 34ch; margin: 0; }
.footer-contacto ul { gap: 14px; }
.footer-contacto li { display: flex; align-items: flex-start; gap: 10px; color: #C9D0E8; font-size: .92rem; line-height: 1.45; }
.footer-contacto svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--blue-light); }
.footer-contacto a { overflow-wrap: anywhere; }
.footer-admin { color: #8A94BD !important; font-size: .85rem !important; }
.footer-admin:hover { color: #fff !important; }

@media (max-width: 960px) {
    footer .footer-grid.footer-grid-v2 { grid-template-columns: 1fr 1fr; gap: 32px; }
    .footer-marca { grid-column: 1 / -1; }
    .footer-reclamos { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
    footer.site-footer { padding: 40px 0 84px; }
    footer .footer-grid.footer-grid-v2 { grid-template-columns: 1fr; gap: 0; margin-bottom: 24px; }
    .footer-marca { text-align: center; padding-bottom: 24px; }
    .footer-logo { margin-bottom: 10px; }
    .footer-logo img { height: 72px; margin: 0 auto; }
    .footer-marca p { margin: 0 auto; font-size: .88rem; }
    .footer-nav, .footer-contacto, .footer-reclamos { border-top: 1px solid rgba(255,255,255,.1); padding: 20px 0; }
    footer h4 { margin-bottom: 12px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: #8A94BD; }
    .footer-nav ul { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
    .footer-nav a { display: block; padding: 8px 0; font-size: .95rem; }
    .footer-contacto ul { gap: 4px; }
    .footer-contacto li { padding: 8px 0; font-size: .95rem; }
    .footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 18px; gap: 8px; font-size: .8rem; }
}
