:root {
    --text-main: #121212;
    --text-muted: #6a6a6a;
    --bg-body: #ffffff;
    --border-color: #e8e8e8;
    --accent: #121212;
}

/* ─── BASE ───────────────────────────────────────── */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
}

/* ─── HEADER ─────────────────────────────────────── */

header {
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    padding: 5px 10px;
    display: flex;
    flex-direction: column;    /* ← cambio clave */
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-main {
    height: 150px;
    width: auto;
    object-fit: contain;
    margin: 8px 0;
    transition: height 0.3s ease;
}

/* ─── FILTROS ────────────────────────────────────── */
/* ─── FILTROS WRAPPER ────────────────────────────── */
.filtros-wrapper {
    position: sticky;
    top: 166px;
    z-index: 99;
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
}

.filtros-topbar {
    display: none; /* oculto en escritorio */
}

.filtros {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 20px;
    background: #fafafa;
}

.filtros select,
.filtros input,
.input-marca-topbar {
    border: 1px solid var(--border-color);
    background: white;
    padding: 8px 12px;
    border-radius: 0;
    font-size: 14px;
    outline: none;
    min-width: 140px;
    transition: border-color 0.2s;
}

.filtros select:focus,
.filtros input:focus,
.input-marca-topbar:focus {
    border-color: #888;
}

.filtros button {
    padding: 8px 20px;
    font-size: 12px;
    white-space: nowrap;
}

/* ─── CATÁLOGO GRID ──────────────────────────────── */
/* SIN !important aquí para que los media queries puedan sobreescribir */
.catalogo {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ─── CARD ───────────────────────────────────────── */
.card {
    cursor: pointer;
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
    display: block;
}

.card:hover img {
    transform: scale(1.04);
}

.card h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.precio {
    color: #121212;
    font-weight: 600;
    font-size: 1rem;
    margin-top: 6px;
}

/* ─── BOTONES GLOBALES ───────────────────────────── */
button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
    cursor: pointer;
}

/* ═══════════════════════════════════════════
   MODAL
═══════════════════════════════════════════ */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-content {
    background: #fff;
    border-radius: 4px;
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    box-shadow: 0 25px 60px rgba(0,0,0,0.35);
    animation: modalEntrada 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEntrada {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.modal-galeria {
    background: #f7f5f2;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
    justify-content: center;
    min-height: 380px;
}

.modal-img-principal {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: 2px;
    transition: opacity 0.2s ease;
}

.modal-thumbs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.modal-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 2px;
    cursor: pointer;
    opacity: 0.55;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
}

.modal-thumb:hover,
.modal-thumb.activo {
    opacity: 1;
    border-color: #121212;
}

.modal-info {
    padding: 2rem 2rem 2rem 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    color: #aaa;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    line-height: 1;
    transition: color 0.2s;
    letter-spacing: 0;
    text-transform: none;
}

.modal-close:hover { color: #121212; }

.modal-codigo {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #9a8c7e;
    margin: 0;
}

.modal-marca {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
    text-transform: uppercase;
}

.modal-modelo {
    font-size: 0.95rem;
    color: #6a6a6a;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-divider {
    height: 1px;
    background: #e8e8e8;
    margin: 0.8rem 0;
}

.modal-descripcion {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.7;
    margin: 0;
    flex: 1;
}

.modal-precio-bloque {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    margin: 0.8rem 0;
}

.modal-precio-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9a8c7e;
}

.modal-precio-valor {
    font-size: 1.8rem;
    font-weight: 700;
    color: #121212;
    letter-spacing: -0.02em;
}

.btn-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background-color: #25d366;
    color: white;
    text-decoration: none;
    padding: 0.9rem 1.2rem;
    border-radius: 2px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: auto;
    transition: background-color 0.25s, transform 0.2s;
}

.btn-whatsapp:hover {
    background-color: #1da851;
    transform: translateY(-2px);
    color: white;
}

/* ─── FOOTER ───────────────────────────────────────── */
footer {
    background-color: #121212;
    color: white;
    padding: 40px 20px;
    margin-top: 50px;
    text-align: center;
}

.footer-content  { max-width: 1200px; margin: 0 auto; }

.footer-socials {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
}

.footer-socials a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.footer-socials a:hover { color: #6a6a6a; }

.footer-info {
    font-size: 14px;
    border-top: 1px solid #333;
    padding-top: 20px;
    color: #aaa;
}

.footer-info p { margin: 5px 0; }

/* ─── HEADER CONTAINER ───────────────────────────── */
.header-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
}

.nav-principal {
    display: flex;
    gap: 2rem;
    padding: 8px 0 6px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    justify-content: center;
}

.nav-link {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-decoration: none;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.nav-link:hover,
.nav-link.activo {
    color: var(--text-main);
    border-bottom-color: var(--text-main);
}

.btn-nav-toggle {
    display: none;
    position: absolute;
    top: 50%;
    right: 12px;              /* ← más margen */
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-main);
    z-index: 10;
}

/* ─── NAV MÓVIL ──────────────────────────────────── */
.nav-movil {
    display: none;
    flex-direction: column;
    background: white;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.nav-movil.abierto { display: flex; }

.nav-movil-link {
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s, color 0.2s;
}

.nav-movil-link:hover,
.nav-movil-link.activo {
    background: #f9f9f9;
    color: var(--text-main);
}

.btn-nav-toggle svg { transition: transform 0.2s; }

/* Cuando está abierto muestra X */
.btn-nav-toggle.abierto svg {
    transform: rotate(90deg);
}

/* ─── BOTÓN LIMPIAR ──────────────────────────────── */
.btn-limpiar {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    white-space: nowrap;
}

.btn-limpiar:hover {
    background: #f3f4f6;
    color: var(--text-main);
    border-color: #aaa;
}

.btn-limpiar-topbar {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 7px 10px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
    display: none; /* solo visible en móvil */
    line-height: 1;
}

.btn-limpiar-topbar:hover {
    background: #f3f4f6;
    color: #e53e3e;
    border-color: #e53e3e;
}






/* ─── PAGINACIÓN ─────────────────────────────────── */
.paginacion {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 2.5rem 1rem 3rem;
    flex-wrap: wrap;
}

.pag-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0;
    text-transform: none;
    padding: 0;
    transition: all 0.2s;
    border-radius: 2px;
}

.pag-btn:hover:not(.disabled):not(.activo) {
    background: #f5f5f5;
    border-color: #aaa;
}

.pag-btn.activo {
    background: #121212;
    color: white;
    border-color: #121212;
}

.pag-btn.disabled {
    opacity: 0.3;
    cursor: default;
}

.pag-nav {
    font-size: 16px;
    font-weight: 400;
}

.pag-dots {
    color: var(--text-muted);
    font-size: 14px;
    padding: 0 4px;
    line-height: 38px;
}

.sin-resultados {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    padding: 3rem 0;
}



/* ─── SKELETON LOADER ────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400px 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 4px;
}

.card-skeleton {
    cursor: default;
}

.card-skeleton .sk-img {
    width: 100%;
    height: 200px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.card-skeleton .sk-titulo {
    height: 14px;
    width: 70%;
    margin-bottom: 8px;
    border-radius: 3px;
}

.card-skeleton .sk-texto {
    height: 12px;
    width: 50%;
    margin-bottom: 6px;
    border-radius: 3px;
}

.card-skeleton .sk-precio {
    height: 14px;
    width: 35%;
    margin-top: 6px;
    border-radius: 3px;
}

/* ─── FADE-IN IMÁGENES ───────────────────────────── */
.card img {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.card img.loaded {
    opacity: 1;
}

/* Modal imagen */
.modal-img-principal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-img-principal.loaded {
    opacity: 1;
}


/* ─── Paginación responsive ──────────────────────── */
@media (max-width: 480px) {
    .pag-btn { width: 34px; height: 34px; font-size: 12px; }
    .paginacion { gap: 4px; padding: 1.5rem 0.5rem 2rem; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
═══════════════════════════════════════════ */

/* ─── Laptop grande (< 1400px) → 4 columnas ── */
@media (max-width: 1400px) {
    .catalogo {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1100px;
    }
}

/* ─── Laptop normal (< 1100px) → 3 columnas ── */
@media (max-width: 1100px) {
    .catalogo {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        padding: 20px;
    }
    .card img { height: 180px; }
}

/* ─── Tablet (< 768px) ───────────────────────── */
@media (max-width: 768px) {
    .logo-main { height: 80px; }

    .filtros-wrapper { top: 96px; }

    /* Topbar visible */
    .filtros-topbar {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        background: #fafafa;
    }

    .btn-filtros-toggle {
        display: flex;
        align-items: center;
        gap: 6px;
        background: #121212;
        color: white;
        border: none;
        padding: 8px 14px;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        cursor: pointer;
        white-space: nowrap;
        border-radius: 2px;
        transition: background 0.2s;
    }

    .btn-filtros-toggle.activo { background: #444; }

    .input-marca-topbar {
        flex: 1;
        min-width: 0;
        padding: 8px 10px;
        font-size: 13px;
        border: 1px solid var(--border-color);
        background: white;
        outline: none;
        border-radius: 0;
    }

    .input-marca-topbar:focus { border-color: #888; }

    /* Panel colapsado por defecto */
    .filtros {
        display: none;
        flex-direction: column;
        gap: 6px;
        padding: 10px 12px 14px;
        border-top: 1px solid var(--border-color);
    }

    .filtros.abierto { display: flex; }

    .filtros select {
        width: 100%;
        min-width: 0;
        font-size: 13px;
        padding: 9px 10px;
    }

    .filtros button {
        width: 100%;
        padding: 10px;
        font-size: 13px;
        margin-top: 2px;
    }

    /* Catálogo */
    .catalogo {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 12px;
        max-width: 100%;
    }

    .card img { height: 150px; }

    /* Modal */
    .modal-content { grid-template-columns: 1fr; max-height: 95vh; }
    .modal-galeria { min-height: 240px; padding: 1rem; }
    .modal-img-principal { max-height: 220px; }
    .modal-info { padding: 1.2rem; }
    .modal-marca { font-size: 1.3rem; }
    
    /* Oculta nav desktop, muestra hamburguesa */
    .nav-principal { display: none; }
    .btn-nav-toggle { display: block; }

    /* Limpiar topbar visible */
    .btn-limpiar-topbar { display: block; }

    /* Ajusta sticky por nav móvil cerrada */
    .filtros-wrapper { top: 96px; }
    
}

/* ─── Móvil (< 480px) ────────────────────────── */
@media (max-width: 480px) {
    .logo-main { height: 65px; }

    .filtros-wrapper { top: 81px; }

    .filtros-topbar { padding: 6px 10px; gap: 6px; }

    .btn-filtros-toggle { padding: 7px 12px; font-size: 12px; }

    .input-marca-topbar { font-size: 12px; padding: 7px 8px; }

    .filtros { padding: 8px 10px 12px; gap: 5px; }

    .filtros select { font-size: 12px; padding: 8px 10px; }

    .filtros button { padding: 9px; font-size: 12px; }

    /* Catálogo */
    .catalogo {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
        max-width: 100%;
    }

    .card img { height: 120px; }
    .card h3  { font-size: 11px; }
    .card p   { font-size: 11px; }
    .precio   { font-size: 0.85rem; }

    /* Modal */
    .modal-galeria       { min-height: 190px; }
    .modal-img-principal { max-height: 180px; }
    .modal-marca         { font-size: 1.1rem; }
    .modal-precio-valor  { font-size: 1.3rem; }
    .modal-info          { padding: 1rem; }

    footer { padding: 24px 14px; margin-top: 24px; }
    .footer-socials { gap: 14px; flex-wrap: wrap; }
}