html {
    scroll-behavior: smooth;
}
/* ------------------------------
   PALETA DE COLORES (DARK MODE - BASE)
--------------------------------*/
:root {
    --primary: #0A2A43;
    --secondary: #1DA1F2;
    --bg: #071A2C;
    --text: #e2e8f0;
    --card-bg: #0F2538;
    --border: #1C3B52;
    --icon: #1DA1F2;
}
/* ------------------------------
   PALETA DE COLORES (LIGHT MODE - ACTIVADO)
--------------------------------*/
.light-mode {
    --bg: #f5f7fa;
    --text: #222;
    --card-bg: #ffffff;
    --border: #d9dce2;
    --icon: #1DA1F2;
}
/* ------------------------------
   ESTILOS GENERALES
--------------------------------*/
body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background .3s, color .3s;
}
/* ------------------------------
   HEADER
--------------------------------*/
header {
    background: #ffffff;
    color: #071A2C;
    padding: 0.85rem 1.25rem;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 20;
    transition: transform .3s ease;
    border-bottom: 1px solid rgba(10, 42, 67, .12);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='64'%3E%3Crect width='160' height='64' fill='white'/%3E%3Cg fill='%2399a3ad' fill-opacity='0.22' font-family='Consolas,monospace' font-size='14'%3E%3Ctext x='10' y='20'%3E1010010010100101%3C/text%3E%3Ctext x='10' y='44'%3E0101101001011010%3C/text%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 220px 90px;
}
header.hide {
    transform: translateY(-100%);
}
header.show-shadow {
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
header .logo {
    display: flex;
    align-items: center;
    gap: 0;
    font-weight: normal;
}
header .logo img {
    height: 64px;
    width: auto;
    object-fit: contain;
}
.logo img { background: transparent; }
.logo img {
    opacity: 0;
    transform: translateY(-10px);
    animation: fadeInLogo .6s ease forwards;
}
@keyframes fadeInLogo {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ------------------------------
   MENÚ DESKTOP
--------------------------------*/
.menu-desktop {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}
.menu-desktop a {
    color: #0A2A43;
    text-decoration: none;
    font-size: .95rem;
    font-weight: 600;
    padding: .45rem .75rem;
    border-radius: 4px;
    transition: .2s;
}
.menu-desktop a:hover {
    color: #071A2C;
    background: rgba(10, 42, 67, 0.10);
}
.menu-desktop a.active {
    color: #071A2C;
    background: rgba(29, 161, 242, 0.18);
}

/* ------------------------------
   MENÚ MÓVIL (CORREGIDO)
--------------------------------*/
#hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    z-index: 1001;
}
#hamburger div {
    width: 25px;
    height: 3px;
    background: #0A2A43;
    border-radius: 3px;
    transition: .3s;
}
#hamburger.active div:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}
#hamburger.active div:nth-child(2) {
    opacity: 0;
}
#hamburger.active div:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* 🔥 FIX: menú móvil estable, sin bloquear scroll */
.menu-mobile {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100dvh; /* FIX Android */
    background: var(--primary);
    padding: 5rem 1.5rem 2rem;
    box-shadow: -4px 0 12px rgba(0,0,0,.3);
    z-index: 1000;

    transform: translateX(100%);
    transition: transform .3s ease;

    overflow-y: auto;

    pointer-events: none; /* No bloquea clics cuando está cerrado */
}

.menu-mobile.open {
    transform: translateX(0);
    pointer-events: auto;
}

.menu-mobile a {
    color: #fff;
    padding: .8rem 0;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.1);
    font-size: 1rem;
    transition: .2s;
}
.menu-mobile a:hover,
.menu-mobile a.active {
    color: var(--secondary);
    padding-left: .5rem;
}

/* ------------------------------
   OVERLAY (CORREGIDO)
--------------------------------*/
.menu-overlay {
    display: block; /* Siempre presente */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,.5);
    z-index: 999;
    opacity: 0;
    transition: opacity .3s;

    pointer-events: none; /* No bloquea clics cuando está cerrado */
}
.menu-overlay.active {
    opacity: 1;
    pointer-events: auto; /* Solo bloquea cuando está activo */
}

/* ------------------------------
   BOTÓN TEMA (SOL/LUNA)
--------------------------------*/
#toggleTheme {
    background: transparent;
    color: #0A2A43;
    border: none;
    padding: .45rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s, transform .2s;
    z-index: 1001;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
#toggleTheme:hover {
    background: rgba(10, 42, 67, 0.10);
    transform: translateY(-1px);
}
#toggleTheme svg {
    width: 22px;
    height: 22px;
}

/* ------------------------------
   BOTONES
--------------------------------*/
.btn-primary {
    background: var(--secondary);
    color: #fff;
    padding: .7rem 1.4rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: .3s;
}
.btn-primary:hover {
    background: var(--primary);
}
.volver-btn {
    background: var(--primary);
    color: #fff;
    padding: .6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: .3s;
}
.volver-btn:hover {
    background: var(--secondary);
}

/* ------------------------------
   HERO
--------------------------------*/
.hero {
    padding: 6rem 1.5rem 3rem;
    margin-bottom: 4rem;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 2.5rem;
}
.hero-content {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.hero-content h1 {
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1.2;
}
.hero-content h1 span {
    color: var(--secondary);
}
.hero-content p {
    font-size: 1.1rem;
    max-width: 500px;
}
.hero-image img {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: cover;
    border-radius: 12px;
}

/* Hero interno */
.hero-interno {
    padding: 5rem 1.5rem 2rem;
    margin-bottom: 2rem;
}
.hero-interno .hero-content h1 {
    font-size: 2.2rem;
}
.hero-interno .hero-content p {
    font-size: 1rem;
}

/* ------------------------------
   SECCIONES
--------------------------------*/
section {
    padding: 3rem 1.5rem;
}
.section-inner {
    max-width: 1100px;
    margin: auto;
}
.grid {
    display: grid;
    gap: 1.5rem;
}
.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* ------------------------------
   TARJETAS
--------------------------------*/
.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.card-index {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: .8rem;
    transition: .2s;
}
.card-index:hover {
    transform: translateY(-4px);
}
.card-index img.card-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}
.card:not(.card-index) img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

/* ------------------------------
   CONTACTO
--------------------------------*/
.contact-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
input, textarea {
    width: 100%;
    padding: .7rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
}

/* ------------------------------
   FOOTER
--------------------------------*/
footer {
    background: #0a304a;
    color: #dbe3f0;
    padding: 1.5rem;
    text-align: center;
}

/* ------------------------------
   BOTÓN IR ARRIBA
--------------------------------*/
.btn-up {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--secondary);
    color: #fff;
    border: none;
    padding: .7rem 1rem;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    z-index: 50;
    transition: .3s;
}
.btn-up:hover {
    background: var(--primary);
}

/* ------------------------------
   RESPONSIVE
--------------------------------*/
@media (max-width: 900px) {
    .menu-desktop {
        display: none;
    }
    #hamburger {
        display: flex;
    }
    header {
        padding: 1rem;
    }
    header .logo img {
        height: 50px;
    }
    #toggleTheme svg {
        width: 20px;
        height: 20px;
    }
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 4rem 1.5rem 2rem;
    }
    .hero-content {
        align-items: center;
    }
    .hero-interno {
        padding: 4rem 1rem 1.5rem;
    }
    .hero-interno .hero-content h1 {
        font-size: 1.8rem;
    }
}

/* ===============================
   FILTROS DE PRODUCTOS
=============================== */
.filtros {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.filtros input,
.filtros select {
    padding: .7rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    min-width: 200px;
}

/* ===============================
   PAGINACIÓN
=============================== */
.paginacion {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}
.paginacion button {
    background: var(--secondary);
    color: #fff;
    padding: .6rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: .3s;
}
.paginacion button:disabled {
    background: #555;
    cursor: not-allowed;
}
.paginacion button:hover:not(:disabled) {
    background: var(--primary);
}
#pageInfo {
    font-weight: bold;
}

/* Vista lista */
#productos.lista .card {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.vista-btn {
    padding: .5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    cursor: pointer;
}
.vista-btn.active {
    background: var(--secondary);
    color: #fff;
}

/* Filtros avanzados */
.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.filtros input,
.filtros select {
    padding: .6rem .8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    min-width: 160px;
}

/* Vista lista */
#productos.lista .card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
#productos.lista .card img {
    width: 120px;
    height: 120px;
}

/* Botones de vista */
.vista-btn {
    padding: .5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    cursor: pointer;
    color: var(--text);
}
.vista-btn.active {
    background: var(--secondary);
    color: #fff;
}

/* Header tarjeta */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
}
.categoria-tag {
    font-size: .75rem;
    padding: .2rem .5rem;
    border-radius: 999px;
    background: rgba(29, 161, 242, 0.15);
    color: var(--text);
}

/* Acciones */
.card-actions {
    margin-top: .8rem;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.btn-secondary {
    background: transparent;
    color: var(--secondary);
    border: 1px solid var(--secondary);
    padding: .5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.btn-secondary:hover {
    background: var(--secondary);
    color: #fff;
}

/* Botón flotante comparar */
.btn-comparar-flotante {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--secondary);
    color: #fff;
    padding: 0.9rem 1.4rem;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    z-index: 9999;
    transition: 0.3s ease;
}
.btn-comparar-flotante:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

/* Botón flotante carrito */
.btn-carrito-flotante {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: var(--secondary);
    color: #fff;
    padding: 0.9rem 1.4rem;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    z-index: 9999;
    transition: 0.3s ease;
}
.btn-carrito-flotante:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

/* Panel lateral carrito */
.carrito-panel {
    position: fixed;
    top: 0;
    right: -400px;
