:root {
    --blue: #004a99;
    --yellow: #ffcc00;
    --dark: #1a1a1a;
    --light: #f8f9fa;
}

* { box-sizing: border-box; }

body { font-family: 'Inter', sans-serif; margin: 0; background: #fff; color: var(--dark); }

/* --- HEADER --- */
.main-header {
    background: white;
    padding: 10px 5%;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.header-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }

.logo { 
    font-size: 28px;
    font-weight: 900; 
    color: var(--blue); 
    cursor: pointer; 
    letter-spacing: -1px;
    white-space: nowrap;
}

.nav-menu { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.nav-menu a, .dropbtn { 
    text-decoration: none; color: var(--dark); font-weight: 600; 
    font-size: 13px; background: none; border: none; cursor: pointer;
    white-space: nowrap;
}
.nav-menu a:hover, .dropbtn:hover { color: var(--blue); }

.header-actions { display: flex; align-items: center; gap: 12px; }
.search-box input { 
    padding: 8px 15px; border-radius: 20px; border: 1px solid #ddd; 
    width: 130px;
    transition: 0.3s;
    font-size: 13px;
}
.search-box input:focus { width: 180px; outline: none; border-color: var(--blue); }

.cart-btn { position: relative; cursor: pointer; }
.cart-btn img { width: 24px; }
.cart-btn span { 
    position: absolute; top: -8px; right: -10px; 
    background: var(--blue); color: white; border-radius: 50%; 
    padding: 2px 6px; font-size: 10px; font-weight: bold;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

/* --- SLIDER --- */
.slider-section { 
    overflow: hidden; 
    background: #000; 
    height: 300px;
    margin-bottom: 30px; 
}
.slider-track {
    display: flex;
    width: 400%;
    height: 100%;
    animation: slideAction 20s infinite ease-in-out;
}
.slide { width: 100%; height: 100%; }
.slide img { 
    width: 100%;
    height: 300px;
    object-fit: fill;
}

@keyframes slideAction {
    0%, 20% { transform: translateX(0); }
    25%, 45% { transform: translateX(-25%); }
    50%, 70% { transform: translateX(-50%); }
    75%, 95% { transform: translateX(-75%); }
    100% { transform: translateX(0); }
}

/* --- LAYOUT Y FILTROS --- */
.main-layout { display: flex; padding: 0 5% 50px 5%; gap: 30px; }
.filters-sidebar { width: 250px; flex-shrink: 0; position: sticky; top: 100px; height: fit-content; }
.filter-card { border-bottom: 1px solid #eee; padding-bottom: 20px; margin-bottom: 20px; }
.filter-card h4 { font-size: 12px; color: #999; margin-bottom: 12px; }
.filter-card select {
    width: 100%;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ddd;
    margin-top: 5px;
    font-size: 13px;
}
.price-inputs { display: flex; gap: 8px; }
.price-inputs input {
    width: 50%;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ddd;
    font-size: 13px;
}
#price-range { width: 100%; margin-top: 10px; accent-color: var(--blue); }
.btn-reset {
    width: 100%;
    padding: 10px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    font-size: 13px;
}
.btn-reset:hover { background: #ddd; }

/* --- FILTER TOGGLE (mobile) --- */
.filter-toggle {
    display: none;
    width: 100%;
    padding: 12px;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 15px;
}

/* --- GRID DE PRODUCTOS --- */
.products-container { flex-grow: 1; min-width: 0; }
.products-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
    gap: 25px; 
}
.product-card { 
    text-align: center; 
    transition: 0.3s; 
    cursor: pointer;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 15px;
    background: white;
}
.product-card:hover { box-shadow: 0 5px 20px rgba(0,0,0,0.08); transform: translateY(-3px); }
.product-card img { width: 100%; height: 180px; object-fit: contain; background: #f9f9f9; border-radius: 8px; padding: 8px; }
.product-card h3 { font-size: 13px; margin: 10px 0 5px 0; line-height: 1.3; }
.product-card .price-tag { font-weight: 800; color: var(--blue); font-size: 17px; margin: 5px 0; }
.brand-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    opacity: 0.7;
}
.btn-add {
    background: var(--yellow);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    font-size: 12px;
    transition: 0.2s;
}
.btn-add:hover { background: #e6b800; }

/* --- PAGINACIÓN --- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 40px;
    padding: 20px;
}
.pagination button {
    padding: 8px 14px;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    border-radius: 5px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: 0.2s;
    min-width: 36px;
    font-size: 13px;
}
.pagination button:hover { background: #d0d0d0; }
.pagination button.active { background: var(--blue); color: white; }

.pagination-dots {
    display: inline-flex;
    align-items: center;
    padding: 8px 3px;
    font-weight: bold;
    color: #999;
    letter-spacing: 2px;
    user-select: none;
    font-size: 13px;
}

.page-search {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
}
.page-search input {
    width: 60px;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ddd;
    text-align: center;
    font-size: 13px;
}
.page-search input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.1);
}
.page-search button {
    padding: 8px 12px;
    border: none;
    background: var(--blue);
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}
.page-search button:hover { background: #003670; }

/* --- WHATSAPP FLOTANTE --- */
.whatsapp-float {
    position: fixed;
    bottom: 25px;
    left: 25px;
    background: #25d366;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 999;
    transition: 0.3s;
}
.whatsapp-float:hover { transform: scale(1.1); }
.whatsapp-float img { width: 30px; }

/* --- CARRITO DRAWER --- */
.cart-drawer { 
    position: fixed; right: -400px; top: 0; width: 380px; max-width: 90vw; height: 100%; 
    background: white; z-index: 2001; transition: 0.4s; box-shadow: -5px 0 15px rgba(0,0,0,0.1); 
    display: flex; flex-direction: column;
}
.cart-drawer.open { right: 0; }
.cart-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000; }
.cart-overlay.open { display: block; }
.cart-header { padding: 20px; background: var(--blue); color: white; display: flex; justify-content: space-between; align-items: center; }
.cart-header h3 { margin: 0; font-size: 18px; }
.cart-header span { font-size: 24px; cursor: pointer; }
.cart-body { flex-grow: 1; overflow-y: auto; padding: 20px; }
.cart-footer { padding: 20px; border-top: 1px solid #eee; }
.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
}
.btn-checkout { 
    width: 100%; 
    background: #25d366; 
    color: white; 
    border: none; 
    padding: 15px; 
    border-radius: 8px; 
    font-weight: bold; 
    cursor: pointer; 
    font-size: 15px;
}

/* Cart info */
#cart-footer-info { margin-bottom: 12px; font-size: 12px; text-align: center; }
.cart-iva { color: #2e7d32; font-weight: 600; margin: 4px 0; font-size: 13px; }
.cart-min-warning { color: #e65100; margin: 4px 0; font-size: 11px; }
.cart-min-ok { color: #2e7d32; margin: 4px 0; font-size: 11px; }
.cart-delivery-info { color: #666; margin: 4px 0; font-size: 11px; }
.cart-delivery-ok { color: #2e7d32; margin: 4px 0; font-size: 11px; font-weight: 600; }

/* --- DROPDOWN MENUS --- */
.dropdown { position: relative; padding-bottom: 10px; margin-bottom: -10px; }

.dropdown-content { 
    display: none; 
    position: absolute; 
    background: white; 
    min-width: 220px;
    max-width: 500px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15); 
    border-radius: 12px; 
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px;
    z-index: 1001;
    border: 1px solid #eee;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 5px;
    max-height: 400px;
    overflow-y: auto;
}
.dropdown:hover .dropdown-content { 
    display: grid;
    animation: fadeIn 0.25s ease-out;
}
.dropdown-content a {
    display: block;
    padding: 8px 10px;
    background: #f4f6f9;
    border-radius: 8px;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dropdown-content a:hover {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 74, 153, 0.25);
}
.dropdown-content a:first-child {
    background: #e8edf3;
    font-weight: 700;
    color: var(--blue);
    border: 1px dashed var(--blue);
}
.dropdown-content a:first-child:hover { background: var(--blue); color: white; }
.dropdown-content::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
    height: 15px;
}
.dropdown-content::-webkit-scrollbar { width: 5px; }
.dropdown-content::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 10px; }
.dropdown-content::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 10px; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Page sections */
.page-section { display: none; }
.page-section.active { display: block; }

/* ============================== */
/*         MOBILE STYLES          */
/* ============================== */
@media (max-width: 768px) {
    .main-header { padding: 10px 4%; }
    .header-container { gap: 8px; }
    .menu-toggle { display: block; }
    .logo { font-size: 22px; }
    
    .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 5px;
        order: 3;
        background: #f8f9fa;
        border-radius: 10px;
        padding: 10px;
    }
    .nav-menu.open { display: flex; }
    .nav-menu a, .dropbtn { 
        font-size: 14px; 
        padding: 8px 10px;
        display: block;
        width: 100%;
        text-align: left;
    }
    
    .header-actions { gap: 8px; }
    .search-box input { width: 100px; font-size: 12px; }
    .search-box input:focus { width: 130px; }
    
    /* Dropdowns en mobile */
    .dropdown { position: static; padding-bottom: 0; margin-bottom: 0; }
    .dropdown-content {
        position: static;
        transform: none;
        left: auto;
        max-width: 100%;
        border-radius: 8px;
        margin-top: 5px;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    .dropdown:hover .dropdown-content { display: grid; }
    
    /* Slider más chico */
    .slider-section { height: 150px; margin-bottom: 20px; }
    .slide img { height: 150px; }
    
    /* Layout: sidebar abajo del contenido en móvil */
    .main-layout { 
        flex-direction: column; 
        padding: 0 4% 40px 4%; 
        gap: 20px; 
    }
    
    .filter-toggle { display: block; }
    
    .filters-sidebar { 
        width: 100%; 
        position: static;
        display: none;
    }
    .filters-sidebar.open { display: block; }
    
    .filter-card select { font-size: 14px; padding: 10px; }
    .price-inputs input { font-size: 14px; padding: 10px; }
    .btn-reset { font-size: 14px; padding: 12px; }
    
    /* Grid de 2 columnas */
    .products-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 12px; 
    }
    .product-card { padding: 10px; border-radius: 10px; }
    .product-card img { height: 130px; padding: 5px; }
    .product-card h3 { font-size: 11px; }
    .product-card .price-tag { font-size: 14px; }
    .btn-add { font-size: 11px; padding: 6px 12px; }
    .brand-label { font-size: 9px; }
    
    /* Paginación compacta */
    .pagination { gap: 4px; padding: 15px 5px; }
    .pagination button { padding: 7px 10px; min-width: 30px; font-size: 11px; }
    .page-search { margin-left: 5px; gap: 4px; }
    .page-search input { width: 45px; padding: 6px; font-size: 11px; }
    .page-search button { padding: 6px 9px; font-size: 10px; }
    
    /* Carrito full-width */
    .cart-drawer { width: 100%; right: -100%; }
    .cart-drawer.open { right: 0; }
    
    /* WhatsApp más chico */
    .whatsapp-float { bottom: 20px; left: 20px; width: 50px; height: 50px; }
    .whatsapp-float img { width: 26px; }
}

/* Pantallas muy chicas (ej. 320-480px) */
@media (max-width: 480px) {
    .products-grid { gap: 10px; }
    .product-card { padding: 8px; }
    .product-card img { height: 110px; }
    .product-card h3 { font-size: 10px; }
    .product-card .price-tag { font-size: 13px; }
    .btn-add { font-size: 10px; padding: 5px 10px; }
    
    .logo { font-size: 20px; }
    .search-box input { width: 80px; font-size: 11px; }
    .search-box input:focus { width: 110px; }
}