/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: white;
    min-height: 100vh;
    color: #1565c0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* ── Utilities ──────────────────────────────────────────────────────────────── */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0;
    margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

.main-content { flex: 1; }

.container {
    width: 100%;
    padding: 0 12px;
    margin: 0 auto;
}

@media (min-width: 768px) { .container { padding: 0 20px; } }
@media (min-width: 1200px) { .container { max-width: 1200px; } }

/* ── Animations ─────────────────────────────────────────────────────────────── */
@keyframes whatsappPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(37,211,102,0.4); }
    50%       { box-shadow: 0 4px 15px rgba(37,211,102,0.8); }
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.header {
    background: #1E3A8A;
    padding: 8px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* Mobile: logo + whatsapp en fila, search abajo */
.header .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.logo { cursor: pointer; flex-shrink: 0; }

.logo-img {
    height: 40px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

.header-actions { margin-left: auto; }

.whatsapp-btn {
    background: linear-gradient(135deg, #25d366, #128c7e) !important;
    color: white !important;
    border-radius: 20px !important;
    padding: 8px 14px !important;
    font-weight: 600 !important;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(37,211,102,0.4);
    animation: whatsappPulse 2s infinite;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    border: none;
}

.whatsapp-btn i { font-size: 16px; }

/* Search bar: full width on mobile */
.search-bar {
    width: 100%;
    display: flex;
    order: 3;
}

.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #1976d2;
    border-right: none;
    border-radius: 20px 0 0 20px;
    font-size: 15px;
    color: #1E3A8A;
    background: white;
    transition: border-color 0.3s;
    -webkit-appearance: none;
}

.search-bar input:focus {
    outline: none;
    border-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255,193,7,0.2);
}

.search-btn {
    background: linear-gradient(135deg, #ffc107, #ff5722);
    border: none;
    padding: 10px 16px;
    border-radius: 0 20px 20px 0;
    cursor: pointer;
    font-weight: 700;
    color: #000;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.search-btn:active { opacity: 0.85; }

/* Desktop header: single row */
@media (min-width: 768px) {
    .header .container { flex-wrap: nowrap; gap: 16px; }
    .logo-img { height: 50px; max-width: 180px; }
    .search-bar { width: auto; flex: 1; max-width: 600px; order: 0; }
    .whatsapp-btn { padding: 10px 20px !important; font-size: 14px; }
    .whatsapp-btn i { font-size: 18px; }
}

/* ── Navigation ─────────────────────────────────────────────────────────────── */
.nav-bar {
    background: #1E3A8A;
    padding: 6px 0;
    box-shadow: 0 2px 10px rgba(25,118,210,0.3);
    position: sticky;
    top: 97px;
    z-index: 99;
}

@media (min-width: 768px) {
    .nav-bar { top: 66px; }
}

.nav-bar .container { display: flex; align-items: center; }

.categories-menu {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
}

.home-btn, .categories-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 13px;
    cursor: pointer;
    padding: 7px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 20px;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
}

.home-btn:active, .categories-btn:active {
    background: rgba(255,255,255,0.35);
}

@media (min-width: 768px) {
    .home-btn, .categories-btn { padding: 8px 16px; font-size: 14px; gap: 8px; }
    .home-btn:hover, .categories-btn:hover { background: rgba(255,255,255,0.3); }
}

/* Categories dropdown — mobile first */
.categories-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #ff6f00;
    width: calc(100vw - 24px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    columns: 2;
    column-gap: 0;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.15);
    overflow: hidden;
}

.categories-dropdown.show { display: block; }

.category-item { break-inside: avoid; }
.menu-cat-wrapper { break-inside: avoid; }

/* 3 columnas en desktop */
@media (min-width: 768px) {
    .categories-dropdown {
        columns: 3;
        width: auto;
        min-width: 600px;
    }
}

.category-item {
    padding: 11px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: white !important;
    font-size: 12px;
    transition: background 0.2s;
}

.category-item:last-child { border-bottom: none; }
.category-item:active { background: rgba(255,255,255,0.2); }

@media (min-width: 768px) {
    .category-item:hover { background: rgba(255,255,255,0.2); transform: translateX(4px); }
}

.category-separator {
    padding: 10px 18px;
    font-size: 12px;
    font-weight: 600;
    color: #1E3A8A !important;
    background: rgba(25,118,210,0.1);
    border-top: 1px solid rgba(0,0,0,0.05);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subcategory-item { padding-left: 36px; background: rgba(25,118,210,0.05); font-size: 13px; }
.other-categories-list { max-height: 200px; overflow-y: auto; }

/* ── Pages ──────────────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; animation: fadeInUp 0.3s ease-out; }

/* ── Products section ───────────────────────────────────────────────────────── */
.products-section {
    padding: 12px 0;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    color: white;
    gap: 8px;
    flex-wrap: wrap;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stock-toggle-btn {
    appearance: none;
    background: white;
    border: 2px solid rgba(25,118,210,0.3);
    border-radius: 16px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #1E3A8A;
    cursor: pointer;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background-color 0.2s, border-color 0.2s;
}

.stock-toggle-btn.active {
    background: linear-gradient(135deg, #ff5722, #e64a19);
    border-color: #ff5722;
    color: white;
}

.sort-options select {
    appearance: none;
    -webkit-appearance: none;
    background: white;
    border: 2px solid rgba(25,118,210,0.3);
    border-radius: 16px;
    padding: 8px 32px 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #1E3A8A;
    cursor: pointer;
    min-width: 160px;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
    min-height: 36px;
}

/* ── Products grid ──────────────────────────────────────────────────────────── */
/* Mobile: 2 columns */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Tablet: 3 columns */
@media (min-width: 600px) {
    .products-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}

/* Desktop: 4 columns */
@media (min-width: 1024px) {
    .products-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
}

/* CLS fix: reserve space before products load */
#homeProductsGrid { min-height: 400px; }

@media (min-width: 768px) { #homeProductsGrid { min-height: 600px; } }

/* ── Product card ───────────────────────────────────────────────────────────── */
.product-card {
    background: rgba(255,255,255,0.97);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    border: 2px solid rgba(25,118,210,0.15);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card:active { transform: scale(0.98); }

@media (min-width: 768px) {
    .product-card { padding: 14px; border-radius: 15px; }
    .product-card:hover {
        transform: translateY(-6px) scale(1.01);
        box-shadow: 0 16px 32px rgba(255,193,7,0.25);
        border-color: #1E3A8A;
    }
}

.product-brand-label {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    padding: 3px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
    display: inline-block;
}

.product-image {
    width: 100%;
    height: 130px;
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

@media (min-width: 600px) { .product-image { height: 160px; } }
@media (min-width: 1024px) { .product-image { height: 180px; } }

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

@media (min-width: 768px) {
    .product-card:hover .product-image img { transform: scale(1.08); }
}

.product-title {
    font-size: 10px;
    margin-bottom: 6px;
    color: #1E3A8A;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

@media (min-width: 600px) { .product-title { font-size: 11px; } }
@media (min-width: 1024px) { .product-title { font-size: 12px; } }

.product-pricing { margin-bottom: 8px; }

.precio-minorista {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #1976d2 !important;
}

@media (min-width: 600px) { .precio-minorista { font-size: 15px !important; } }
@media (min-width: 1024px) { .precio-minorista { font-size: 16px !important; } }

.product-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    align-items: center;
}

.btn-ver-mas {
    flex: 1;
    background: linear-gradient(135deg, #ff5722, #e64a19);
    color: white;
    border: none;
    padding: 9px 8px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: opacity 0.2s;
    min-height: 44px;
}

.btn-ver-mas:active { opacity: 0.85; }

@media (min-width: 768px) {
    .btn-ver-mas { font-size: 12px; padding: 10px 12px; }
    .btn-ver-mas:hover { box-shadow: 0 6px 16px rgba(255,87,34,0.4); }
}

.btn-whatsapp-product {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(37,211,102,0.3);
    transition: opacity 0.2s;
}

.btn-whatsapp-product:active { opacity: 0.85; }

/* ── Lazy loading ───────────────────────────────────────────────────────────── */
.lazy-load {
    opacity: 0;
    transition: opacity 0.4s ease;
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
}

/* ── Search page ────────────────────────────────────────────────────────────── */
#searchTitle {
    color: #1E3A8A !important;
    background: none !important;
    -webkit-text-fill-color: #1E3A8A !important;
    font-size: 1.3rem;
    margin: 12px 0 8px;
}

@media (min-width: 768px) { #searchTitle { font-size: 1.8rem; margin: 16px 0 12px; } }

/* Mobile: filters collapsed above grid */
.search-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

@media (min-width: 768px) {
    .search-content { flex-direction: row; gap: 24px; margin-top: 16px; }
}

/* Filters sidebar */
.filters-sidebar {
    background: rgba(255,255,255,0.97);
    padding: 14px;
    border-radius: 14px;
    border: 2px solid rgba(25,118,210,0.2);
    width: 100%;
}

@media (min-width: 768px) {
    .filters-sidebar { width: 220px; flex-shrink: 0; height: fit-content; position: sticky; top: 110px; max-height: calc(100vh - 120px); overflow-y: auto; }
}

@media (min-width: 1024px) { .filters-sidebar { width: 250px; } }

/* Filters toggle (mobile only) */
.filters-toggle {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
    color: #1565c0;
}

.filters-toggle i { transition: transform 0.3s ease; }
.filters-toggle i.rotated { transform: rotate(180deg); }

/* Hide filter groups on mobile by default */
.filter-section .filter-group { display: none; }
.filter-section.expanded .filter-group { display: block; }

/* Always show on desktop */
@media (min-width: 768px) {
    .filter-section .filter-group { display: block; }
}

.filter-group { margin-bottom: 18px; }

.filter-group h4 {
    margin-bottom: 8px;
    font-size: 12px;
    color: #1565c0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #333;
    padding: 4px 0;
    cursor: pointer;
}

.price-range {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.price-range input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    width: 100%;
}

.price-range button {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    min-height: 44px;
}

/* ── Product detail ─────────────────────────────────────────────────────────── */
.product-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 16px 0;
    background: white;
    padding: 16px;
    border-radius: 12px;
    color: #1E3A8A;
}

@media (min-width: 768px) {
    .product-detail { flex-direction: row; gap: 40px; padding: 30px; margin: 24px 0; }
}

.product-images { flex: 1; }

.product-images img {
    width: 100%;
    max-width: 100%;
    border-radius: 10px;
    background: #f0f0f0;
    height: 220px;
    object-fit: contain;
    border: 1px solid #eee;
}

@media (min-width: 768px) { .product-images img { height: 280px; } }

.product-info { flex: 1; }

#productTitle {
    font-size: 18px;
    margin-bottom: 10px;
    font-weight: 700;
    color: #1E3A8A !important;
    background: none !important;
    -webkit-text-fill-color: #1E3A8A !important;
    line-height: 1.3;
}

@media (min-width: 768px) { #productTitle { font-size: 22px; } }

.product-brand {
    color: #1976d2;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.product-code {
    color: #1976d2;
    margin-bottom: 16px;
    font-weight: 500;
    font-size: 14px;
}

#productPrice {
    color: #1E3A8A !important;
    margin-bottom: 20px;
}

#productPrice .precio-minorista {
    font-size: 22px !important;
    color: #1E3A8A !important;
}

.add-to-cart-btn {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    border: none;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 25px;
    cursor: pointer;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    transition: opacity 0.2s;
}

.add-to-cart-btn:active { opacity: 0.85; }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 20px 0;
    padding: 10px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 10px 14px;
    border: 2px solid rgba(25,118,210,0.2);
    background: rgba(255,255,255,0.95);
    color: #2d3748;
    cursor: pointer;
    border-radius: 16px;
    font-weight: 600;
    font-size: 13px;
    min-width: 44px;
    min-height: 44px;
    text-align: center;
    transition: background 0.2s, border-color 0.2s;
}

.pagination-btn:active { background: rgba(25,118,210,0.1); }

.pagination-btn.active {
    background: linear-gradient(135deg, #ff5722, #e64a19);
    color: white;
    border-color: #ff5722;
}

@media (min-width: 768px) {
    .pagination { gap: 8px; margin: 28px 0; }
    .pagination-btn:hover { background: rgba(25,118,210,0.1); border-color: #1976d2; }
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.footer {
    background: #1E3A8A;
    padding: 14px 0;
    margin-top: auto;
    box-shadow: 0 -4px 20px rgba(25,118,210,0.2);
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

.footer-info p {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: white;
}

.footer-info strong { font-weight: 700; color: white; }

/* ── Categorías en el footer (enlaces internos SSR, estilo chips) ───────────── */
.footer-categorias {
    max-width: 1100px;
    margin: 0 auto 14px;
    padding: 0 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.18);
}
.footer-categorias h2 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 10px;
    opacity: 0.9;
}
.footer-categorias ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.footer-categorias li { margin: 0; }
.footer-categorias a {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    font-size: 12.5px;
    text-decoration: none;
    transition: background 0.15s ease;
    white-space: nowrap;
}
.footer-categorias a:hover { background: rgba(255,255,255,0.25); }

/* ── Color overrides ────────────────────────────────────────────────────────── */
.header *, .nav-bar *, .footer * { color: white !important; }
.whatsapp-btn, .whatsapp-btn * { color: white !important; }
.btn-ver-mas, .add-to-cart-btn { color: white !important; }

/* Category dropdown text: blanco sobre naranja */
.categories-dropdown,
.categories-dropdown .category-item,
.categories-dropdown .category-item *,
.categories-dropdown .category-separator,
.categories-dropdown .category-separator * { color: white !important; }

/* Search input text */
#searchInput, .search-bar input { color: #1E3A8A !important; }

/* ── Font Awesome: avoid FOIT ───────────────────────────────────────────────── */
@font-face { font-family: 'Font Awesome 6 Free';   font-display: swap; }
@font-face { font-family: 'Font Awesome 6 Brands'; font-display: swap; }

/* ── Especificaciones ───────────────────────────────────────────────────────── */
.especificaciones-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.spec-descripcion,
.spec-tabla {
    background: white;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(25,118,210,0.15);
}

.spec-descripcion h3,
.spec-tabla h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1E3A8A;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(25,118,210,0.15);
    background: none;
    -webkit-text-fill-color: #1E3A8A;
}

.spec-descripcion p {
    font-size: 13px;
    color: #444;
    line-height: 1.7;
    white-space: pre-line;
}

.spec-tabla table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.spec-tabla tr:nth-child(even) { background: #f8f9ff; }

.spec-tabla td {
    padding: 8px 10px;
    border-bottom: 1px solid #eef0f8;
    color: #333;
    vertical-align: top;
}

.spec-tabla td:first-child {
    font-weight: 600;
    color: #1E3A8A;
    width: 40%;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .spec-tabla td:first-child { width: 30%; }
}

/* ── Menú jerárquico ────────────────────────────────────────────────────────── */
.menu-cat {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 11px;
    color: white !important;
    transition: background 0.15s;
}

.menu-cat:active, .menu-cat:hover { background: rgba(255,255,255,0.2); }

.menu-sub {
    display: none;
    background: rgba(0,0,0,0.15);
    border-left: 3px solid rgba(255,255,255,0.3);
}

.menu-sub.open { display: block; }

.menu-subcat {
    padding: 10px 18px 10px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    font-size: 13px;
    color: white !important;
    transition: background 0.15s;
}

.menu-subcat:active, .menu-subcat:hover { background: rgba(255,255,255,0.15); }

.menu-marca {
    padding: 9px 18px 9px 36px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    font-size: 13px;
    color: rgba(255,255,255,0.85) !important;
    transition: background 0.15s;
}

.menu-marca:last-child { border-bottom: none; }
.menu-marca:active, .menu-marca:hover { background: rgba(255,255,255,0.15); color: white !important; }

.menu-arrow {
    font-size: 11px;
    color: white !important;
    transition: transform 0.2s;
    flex-shrink: 0;
}

/* ── Sin stock badge ────────────────────────────────────────────────────────── */
.sin-stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #d32f2f;
    color: white !important;
    font-size: 16px;
    font-weight: 800;
    padding: 10px 18px;
    border-radius: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(211,47,47,0.4);
}

.sin-stock-badge i { font-size: 18px; }

.sin-stock-precio {
    opacity: 0.45;
    text-decoration: line-through;
}

/* ── Sin stock en card ──────────────────────────────────────────────────────── */
.sin-stock-card { opacity: 0.75; }

.sin-stock-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #d32f2f;
    color: white !important;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
}

.product-image { position: relative; }

/* ── Filter drawer mobile ───────────────────────────────────────────────────── */

/* Ocultar sidebar en mobile, mostrar solo en desktop */
.filters-sidebar { display: none; }
@media (min-width: 768px) { .filters-sidebar { display: block; } }

/* Overlay */
.filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
}
.filter-overlay.open { display: block; }

/* Drawer */
.filter-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    z-index: 201;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
.filter-drawer.open { transform: translateY(0); }

.filter-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    font-weight: 700;
    font-size: 14px;
    color: #1E3A8A;
    flex-shrink: 0;
}

/* Handle bar */
.filter-drawer-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

.filter-drawer-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    min-height: 44px;
    min-width: 44px;
}

.filter-drawer-body {
    overflow-y: auto;
    padding: 16px 20px;
    flex: 1;
}

.filter-drawer-body .filter-group { margin-bottom: 20px; }

.filter-drawer-body .filter-group h4 {
    font-size: 11px;
    font-weight: 700;
    color: #1E3A8A;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #f0f4ff;
}

.filter-drawer-body label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #333;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    min-height: 44px;
}

.filter-drawer-body input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #1E3A8A;
    flex-shrink: 0;
}

.filter-drawer-body .price-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.filter-drawer-body .price-range input {
    padding: 10px 12px;
    border: 2px solid #e0e7ff;
    border-radius: 10px;
    font-size: 14px;
    color: #1E3A8A;
}

.filter-drawer-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.filter-clear-btn {
    flex: 1;
    padding: 14px;
    border: 2px solid #1E3A8A;
    background: white;
    color: #1E3A8A;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    min-height: 48px;
}

.filter-apply-btn {
    flex: 2;
    padding: 14px;
    background: linear-gradient(135deg, #1E3A8A, #1976d2);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    min-height: 48px;
}

/* Botón Filtrar en la barra de resultados */
.products-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-fab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1E3A8A;
    color: white !important;
    border: none;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    min-height: 36px;
    position: relative;
}

.filter-active-count {
    background: #ff5722;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ocultar botón filtrar en desktop */
@media (min-width: 768px) {
    .filter-fab { display: none; }
    .filter-drawer, .filter-overlay { display: none !important; }
    .products-header-left { gap: 0; }
}


.results-count-badge {
    appearance: none;
    -webkit-appearance: none;
    background: white;
    border: 2px solid rgba(25,118,210,0.3);
    border-radius: 16px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #1E3A8A;
    white-space: nowrap;
    min-height: 36px;
    display: flex;
    align-items: center;
}

/* ── Stock Filter Switch Override ─────────────────────────────────────────────── */

.sort-options {
    gap: 12px !important;
}

.stock-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 12px;
    border-radius: 20px;
    border: 2px solid rgba(25,118,210,0.2);
}

.stock-filter-label {
    font-size: 13px;
    font-weight: 500;
    color: #1E3A8A;
    margin: 0;
    white-space: nowrap;
    user-select: none;
}

.stock-toggle-switch {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    background: #ccc;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    position: relative;
    transition: background 0.3s ease;
    outline: none;
}

.stock-toggle-switch::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: left 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.stock-toggle-switch:checked {
    background: linear-gradient(135deg, #ff5722, #e64a19);
}

.stock-toggle-switch:checked::before {
    left: 22px;
}

.stock-toggle-switch:active::before {
    width: 26px;
}

/* ── Filtro idioma teclado ──────────────────────────────────────────────────── */
.idioma-filter-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 0 4px;
}

.idioma-btn {
    background: white;
    border: 2px solid rgba(25,118,210,0.3);
    color: #1E3A8A;
    border-radius: 20px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    min-height: 36px;
}

.idioma-btn.active,
.idioma-btn:active {
    background: linear-gradient(135deg, #1E3A8A, #1976d2);
    border-color: #1E3A8A;
    color: white;
}

@media (min-width: 768px) {
    .idioma-btn:hover:not(.active) {
        border-color: #1976d2;
        background: rgba(25,118,210,0.08);
    }
}
