/* -------------------
 * RESET & BASE - Buenas Prácticas
 * ------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================================================
   🔥 VARIABLES REDEFINIDAS PARA ESTÉTICA ZYRUN.EC NEÓN 🔥
   ========================================================= */
:root {
    /* Fondo principal: Morado/Negro profundo */
    --bg: #1A0033; 
    /* Fondo para tarjetas y modales, un poco más claro que el fondo */
    --card-bg: #220044; 

    /* Colores Neón (Brillantes y de Alto Contraste) */
    --neon-cyan: #00FFFF;
    --neon-magenta: #FF00FF;

    /* Acciones principales (Cian Neón) */
    --primary: var(--neon-cyan);
    --primary-dark: #00BFFF; 

    /* Colores Secundarios (Magenta Neón) */
    --secondary: var(--neon-magenta);
    --secondary-dark: #CC00CC; 

    /* Texto */
    --text: #E0E0E0; 
    --text-light: #AAAAAA; 

    --radius: 8px;
    /* Sombra de neón */
    --shadow: 0 0 10px rgba(0, 255, 255, 0.4), 0 0 5px rgba(255, 0, 255, 0.2);
}

body {
    font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding: 20px; /* Padding base para escritorio */
    line-height: 1.5;
}

/* -------------------
 * HEADER - ESTILOS BASE Y ESCRITORIO
 * Logo a la izquierda, título y filtros a la derecha.
 * ------------------- */
header {
    text-align: center;
    margin-bottom: 30px;
    background: var(--bg);
    padding: 0;
    position: relative; 
}

/* Contenedor principal del header: Utiliza Grid (Escritorio) */
.header-top {
    /* Define 3 columnas: [Logo (30%)] [Título (restante)] [Carrito (auto)] */
    display: grid;
    grid-template-columns: 30% 1fr auto; 
    gap: 10px;
    align-items: center;
    padding: 10px 40px; 
    max-width: 1400px; 
    margin: 0 auto 15px auto;
}

/* 1. Logo (Escritorio) */
.logo {
    grid-column: 1 / 2;
    justify-self: start; 
    max-height: 55px;
    width: auto; 
    object-fit: contain;
}

/* 2. Título principal (Escritorio) */
header h1 {
    grid-column: 2 / 3;
    color: var(--neon-cyan);
    font-size: clamp(2rem, 3.5vw, 3rem);
    font-weight: 700;
    text-align: left;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2); 
    margin: 0;
}

/* 3. Icono Carrito (Escritorio y FIJO) */
.icono-carrito {
    /* Quitamos el posicionamiento de grid para fijarlo a la ventana */
    
    font-size: 2.2rem;
    color: var(--primary); 
    text-shadow: 0 0 5px var(--primary);
    cursor: pointer;
    
    /* 🔥 FIJAR A LA PANTALLA 🔥 */
    position: fixed; 
    top: 20px;       
    right: 20px;     
    z-index: 999;    
    
    transition: transform 0.2s ease;
}

.icono-carrito:hover {
    transform: scale(1.1);
    color: var(--neon-magenta);
    text-shadow: 0 0 8px var(--neon-magenta);
}

#contador-carrito {
    background: var(--neon-magenta);
    color: var(--bg);
    border-radius: 50%;
    padding: 3px 7px;
    font-size: 0.8rem;
    font-weight: 700;
    position: absolute;
    top: -12px;
    right: -12px;
    box-shadow: 0 0 8px var(--neon-magenta);
}

/* 4. Filtros (Escritorio) */
.filtros {
    grid-column: 2 / 4; 
    display: flex;
    justify-content: flex-start;
    gap: 10px; /* ✅ Espacio reducido entre filtros */
    flex-wrap: wrap;
    width: 100%;
    margin: 10px 0 0 0;
}

.filtros input,
.filtros select {
    background: var(--card-bg);
    color: var(--text);
    padding: 12px 18px; 
    border: 2px solid var(--neon-magenta);
    border-radius: 12px;
    min-width: 150px;
    flex-grow: 1;
    max-width: 250px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.filtros input:focus,
.filtros select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
    outline: none;
}

/* -------------------
 * CATEGORÍAS
 * ------------------- */
.categoria {
    margin-bottom: 10px; /* ✅ Espacio reducido entre categorías */
    animation: fadeIn 0.6s ease-in-out;
}

.categoria h2 {
    /* Degradado de cian a magenta neón */
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
    color: var(--bg);
    font-weight: 900;
    font-size: 1.4rem;
    padding: 14px 25px;
    border-radius: 0; 
    text-transform: uppercase;
    text-align: left;
    letter-spacing: 1px;

    /* Propiedades para que la barra se extienda de borde a borde */
    width: 100vw; 
    margin-left: -20px; 
    position: relative;

    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.4); 
}

.categoria h2::after {
    content: "▼";
    font-size: 0.9rem;
    transition: transform 0.3s ease;
    color: var(--bg);
}

.categoria.abierta h2::after {
    transform: rotate(180deg);
}

/* -------------------
 * PRODUCTOS 
 * ------------------- */
.productos {
    display: grid;
    /* ✅ Tamaño de tarjetas ajustado (300px min-width) */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 30px;
    margin-top: 5px;
    align-items: stretch;

    /* Propiedades clave del acordeón */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

.categoria.abierta .productos {
    max-height: 100000px;
    margin-top: 30px; 
}

.producto {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 15px 20px;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
    border: 1px solid var(--neon-cyan); 
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
}

.id-etiqueta {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--neon-magenta);
    color: var(--bg);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    box-shadow: 0 0 6px var(--neon-magenta);
}

.producto:hover {
    transform: translateY(-8px);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
    border-color: var(--neon-magenta);
}

.producto img {
    max-width: 100%;
    height: 180px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 0px;
}

.producto h3 {
    margin: -2px -2px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    flex-shrink: 0;
}

.producto .descripcion-producto,
.producto p:not(.precio):not(.stock) {
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    margin: -1px 0 -5px 0;
    color: white;
    
    /* 🔥 ELIMINAMOS -webkit-line-clamp: 2 para que el JS controle el "Leer Más" */
    display: block; /* Vuelve a ser un bloque normal */
    
    /* Las siguientes propiedades son ahora controladas por JS (habilitarLeerMas) */
    /* Dejamos solo los estilos visuales base. La restricción de altura la pone JS */
    /* La propiedad overflow la controla temporalmente JS */
    text-overflow: ellipsis; /* Esto es solo visual si el JS corta la línea */
}

.precio {
    font-weight: 700;
    color: var(--neon-magenta);
    font-size: 1.35rem;
    margin: -22px 0 -2px 0;
    padding-bottom: 0;
    text-shadow: 0 0 3px var(--neon-magenta);
}

.stock {
    font-size: 0.85rem;
    color: white;
    margin: -20px 0 0 0;
    padding-bottom: 0px;
}

.producto button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
    margin-top: -20px;
}

.producto button:active {
    transform: scale(0.99);
}

/* Botón principal: AGREGAR CARRITO (Cian Neón) */
.agregar-carrito {
    background: var(--primary);
    color: var(--bg);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.agregar-carrito:hover {
    background: var(--primary-dark);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
}

/* Botón secundario: LEER MÁS (Magenta Neón) */
.leer-mas {
    background: var(--secondary);
    color: var(--bg);
    margin-top: 1px;
    box-shadow: 0 0 8px rgba(255, 0, 255, 0.4);
}

.leer-mas:hover {
    background: var(--secondary-dark);
    box-shadow: 0 0 12px rgba(255, 0, 255, 0.7);
}


/* -------------------
 * MODALES (Estilos de Carrito y Formulario)
 * ------------------- */
.carrito-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.carrito-contenido {
    background: var(--card-bg);
    border: 2px solid var(--neon-cyan);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    animation: modalIn 0.3s ease-in-out;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.7);
}

.carrito-contenido button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 10px;
    transition: background 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.carrito-contenido h2 {
    color: var(--primary);
    text-shadow: 0 0 5px var(--primary);
    margin-bottom: 15px;
}

#lista-carrito {
    list-style: none;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px;
    text-align: left;
    border-top: 1px solid var(--text-light);
    padding-top: 10px;
}

#lista-carrito li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dotted var(--text-light);
    font-size: 1rem;
    color: var(--text);
}

.carrito-contenido p:has(#total-carrito) {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neon-magenta);
    text-shadow: 0 0 5px var(--neon-magenta);
    padding: 10px 0;
    margin-bottom: 5px;
    border-top: 1px solid var(--neon-cyan);
}

#lista-carrito li button {
    background: none;
    border: 1px solid var(--neon-magenta);
    color: var(--neon-magenta);
    border-radius: 50%;
    padding: 2px 7px;
    font-weight: 700;
    box-shadow: none;
}
#lista-carrito li button:hover {
    background: var(--neon-magenta);
    color: var(--bg);
}


/* Botón de acción principal: ENVIAR PEDIDO (Cian Neón) */
#btn-enviar-pedido,
#formulario-pedido button[type="submit"] {
    background: var(--primary);
    color: var(--bg);
    margin-right: 0;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

#btn-enviar-pedido:hover,
#formulario-pedido button[type="submit"]:hover {
    background: var(--primary-dark);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
}


/* Botones secundarios: CERRAR (Magenta Neón) */
#cerrar-carrito,
#cerrar-formulario {
    background: var(--secondary);
    color: var(--bg);
    box-shadow: 0 0 8px rgba(255, 0, 255, 0.4);
}

#cerrar-carrito:hover,
#cerrar-formulario:hover {
    background: var(--secondary-dark);
    color: var(--bg);
    box-shadow: 0 0 12px rgba(255, 0, 255, 0.7);
}

/* Formulario de Pedido */
#formulario-pedido input,
#formulario-pedido textarea {
    background: var(--card-bg);
    color: var(--text);
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid white;
    border-radius: 5px;
}

#formulario-pedido input:focus,
#formulario-pedido textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
    outline: none;
}

#formulario-pedido textarea {
    resize: vertical;
    min-height: 80px;
}

/* -------------------
 * FOOTER
 * ------------------- */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    font-size: 0.9rem;
    color: white;
    border-top: 1px solid var(--neon-magenta);
}

.contacto {
    text-align: center;
    margin: 10px 0 15px 0;
    font-weight: 600;
    color: var(--primary);
    text-shadow: 0 0 5px var(--primary);
    font-size: 1rem;
}


/* =========================================================
   MEDIA QUERY PARA RESPONSIVIDAD (MÓVIL Y TABLET PEQUEÑA) 📱
   ========================================================= */
@media (max-width: 768px) {
    /* Ajuste del BODY para un padding más pequeño en móvil */
    body {
        padding: 10px;
    }

    /* Ajuste del HEADER - Se apila en un formato vertical */
    .header-top {
        /* Usamos una sola columna para apilar los elementos */
        display: grid;
        grid-template-columns: 1fr; /* Una sola columna */
        padding: 10px 10px; 
        gap: 10px;
    }

    /* 1. Logo: Fila 1 - Arriba y Centrado */
    .logo {
        grid-column: 1 / -1; 
        order: 1; /* Fila 1 */
        max-height: 48px; 
        width: auto; 
        justify-self: center; /* Centra el logo */
        margin-bottom: 0;
    }

    /* 2. Título principal: Fila 2 - Centrado */
    header h1 {
        grid-column: 1 / -1; 
        order: 2; /* Fila 2 */
        font-size: 1.8rem; 
        text-align: center; 
        justify-self: center; /* Centra el título */
        margin: 0;
    }
    
    /* 3. Carrito: Fijo en la esquina */
    .icono-carrito {
        right: 10px; 
        top: 10px; 
        font-size: 1.8rem;
    }
    
    /* 4. Filtros: Fila 3 - Se apilan y ocupan todo el ancho */
    .filtros {
        grid-column: 1 / -1;
        order: 3;
        justify-content: center;
        flex-direction: column; /* Apilamos los filtros */
        gap: 5px;
        margin: 0;
    }
    
    .filtros input,
    .filtros select {
        min-width: 100%;
        max-width: 100%;
    }

    /* Ajuste para la barra de categoría extendida */
    .categoria h2 {
        width: 100vw;
        margin-left: -10px; /* Contrarresta el padding de 10px del body en móvil */
        font-size: 1.2rem;
        padding: 10px 15px;
    }
}
