:root {
    --blanco-puro: #ffffff;
    --blanco-hueso: #f8f9fa;
    --gris-medio: #e9ecef;
    --azul-marino: #0A1A44; /* MODIFICADO: de #0B1E33 a azul marino primario */
    --azul-marino-oscuro: #1E3A8A; /* MODIFICADO: de #05121f a azul marino secundario */
    --rojo-principal: #3B5BDB; /* MODIFICADO: de #D32F2F a azul acento */
    --sombra-suave: 0 10px 30px rgba(10, 26, 68, 0.1); /* MODIFICADO: sombra con nuevo azul */
    --sombra-fuerte: 0 15px 40px rgba(10, 26, 68, 0.2); /* MODIFICADO: sombra con nuevo azul */
    --transicion-suave: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {    
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes imageLoad {
    from {
        opacity: 0.6;
        filter: blur(5px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

.productos-page {
    background: linear-gradient(135deg, var(--blanco-hueso) 0%, var(--blanco-puro) 100%);
    min-height: 100vh;
    padding: 120px 0 60px;
    position: relative;
    overflow-x: hidden;
}

.productos-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 20%, rgba(59, 91, 219, 0.03) 0%, transparent 50%), /* MODIFICADO */
                radial-gradient(circle at 90% 80%, rgba(10, 26, 68, 0.03) 0%, transparent 50%); /* MODIFICADO */
    pointer-events: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    position: relative;
    z-index: 2;
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease;
}

.page-header h1 {
    font-size: 2.8rem;
    color: var(--azul-marino);
    margin-bottom: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    display: inline-block;
}

.page-header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--rojo-principal), var(--azul-marino));
    border-radius: 2px;
}

.page-header p {
    color: #4a5568;
    font-size: 1.2rem;
    max-width: 600px;
    margin: 20px auto 0;
    line-height: 1.6;
}

.buscador-productos {
    display: flex;
    gap: 20px;
    margin-bottom: 50px;
    background: var(--blanco-puro);
    padding: 25px;
    border-radius: 20px;
    box-shadow: var(--sombra-suave);
    border: 1px solid rgba(59, 91, 219, 0.1); /* MODIFICADO */
    animation: fadeInUp 0.8s ease 0.2s both;
    position: relative;
    z-index: 10;
}

.buscador-productos::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(59, 91, 219, 0.02), transparent); /* MODIFICADO */
    border-radius: 20px;
    pointer-events: none;
}

.buscador-input {
    flex: 2;
    position: relative;
}

.buscador-input i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--rojo-principal);
    font-size: 1.2rem;
    z-index: 2;
    transition: all 0.3s ease;
}

.buscador-input input {
    width: 100%;
    padding: 16px 20px 16px 45px;
    border: 2px solid var(--gris-medio);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transicion-suave);
    background: var(--blanco-puro);
    color: var(--azul-marino);
    font-weight: 500;
}

.buscador-input input:focus {
    outline: none;
    border-color: var(--rojo-principal);
    box-shadow: 0 0 0 4px rgba(59, 91, 219, 0.1); /* MODIFICADO */
}

.buscador-input input:focus + i {
    color: var(--azul-marino);
}

.buscador-input input::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

#filtroCategoria {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--gris-medio);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--blanco-puro);
    color: var(--azul-marino);
    cursor: pointer;
    transition: var(--transicion-suave);
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233B5BDB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); /* MODIFICADO */
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 16px;
}

#filtroCategoria:focus {
    outline: none;
    border-color: var(--rojo-principal);
    box-shadow: 0 0 0 4px rgba(59, 91, 219, 0.1); /* MODIFICADO */
}

#filtroCategoria option {
    background: var(--blanco-puro);
    color: var(--azul-marino);
    padding: 10px;
}

/* Sistema de columnas responsivo mejorado */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 columnas en pantallas grandes */
    gap: 30px;
    animation: fadeInUp 0.8s ease 0.4s both;
}

.producto-card {
    background: var(--blanco-puro);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--sombra-suave);
    transition: var(--transicion-suave);
    border: 1px solid rgba(59, 91, 219, 0.1); /* MODIFICADO */
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    animation: fadeInUp 0.6s ease;
    animation-fill-mode: both;
}

/* Control de calidad de imágenes - Altura fija y consistente */
.producto-imagen {
    height: 220px; /* Altura fija para consistencia */
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, var(--gris-medio), var(--blanco-hueso));
    /* Efecto de carga mientras la imagen no está lista */
    background-size: 200% 200%;
    animation: imageLoad 0.8s ease;
}

.producto-imagen::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(to top, rgba(10, 26, 68, 0.7), transparent); /* MODIFICADO */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.producto-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Mantiene la proporción sin deformar */
    transition: transform 0.8s ease;
    /* Animación suave al cargar */
    animation: imageLoad 0.5s ease;
}

/* Placeholder mientras carga la imagen */
.producto-imagen img[data-src] {
    opacity: 0.6;
    filter: blur(5px);
}

.producto-imagen img.loaded {
    opacity: 1;
    filter: blur(0);
}

.producto-card:hover .producto-imagen::after {
    opacity: 1;
}

.producto-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 45px rgba(59, 91, 219, 0.15); /* MODIFICADO */
    border-color: var(--rojo-principal);
}

.producto-card:hover::before {
    transform: scaleX(1);
}

.producto-card:hover .producto-imagen img {
    transform: none;
}

.producto-info {
    padding: 25px;
    position: relative;
    z-index: 1;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: var(--blanco-puro);
}

.producto-info h3 {
    color: var(--azul-marino);
    margin-bottom: 12px;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.producto-card:hover .producto-info h3 {
    color: var(--rojo-principal);
}

.producto-info p {
    color: #4a5568;
    line-height: 1.6;
    font-size: 0.95rem;
    margin-bottom: 20px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-consultar {
    width: 100%;
    padding: 14px;
    background: var(--azul-marino);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: auto;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-consultar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: -1;
}

.btn-consultar:hover {
    background: var(--rojo-principal);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 91, 219, 0.3); /* MODIFICADO */
}

.btn-consultar:hover::before {
    width: 300px;
    height: 300px;
}

.btn-consultar i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.btn-consultar:hover i {
    transform: scale(1.2);
}

.producto-card::after {
    content: 'Disponible';
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 5px 15px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
    z-index: 3;
    animation: pulse 2s infinite;
}

.producto-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--rojo-principal), var(--azul-marino));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    z-index: 2;
}

/* Retrasos escalonados para las tarjetas */
.producto-card:nth-child(1) { animation-delay: 0.1s; }
.producto-card:nth-child(2) { animation-delay: 0.2s; }
.producto-card:nth-child(3) { animation-delay: 0.3s; }
.producto-card:nth-child(4) { animation-delay: 0.4s; }
.producto-card:nth-child(5) { animation-delay: 0.5s; }
.producto-card:nth-child(6) { animation-delay: 0.6s; }
.producto-card:nth-child(7) { animation-delay: 0.7s; }
.producto-card:nth-child(8) { animation-delay: 0.8s; }

.no-resultados {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: var(--blanco-puro);
    border-radius: 20px;
    box-shadow: var(--sombra-suave);
    border: 2px dashed var(--rojo-principal);
}

.no-resultados i {
    font-size: 4rem;
    color: var(--rojo-principal);
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-resultados p {
    color: var(--azul-marino);
    font-size: 1.2rem;
    font-weight: 600;
}

.productos-grid.loading {
    position: relative;
    min-height: 300px;
}

.productos-grid.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid var(--gris-medio);
    border-top-color: var(--rojo-principal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Media Queries Responsivos */
@media (max-width: 1200px) {
    .productos-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 columnas en pantallas medianas */
        gap: 25px;
    }
    
    .producto-imagen {
        height: 200px;
    }
}

@media (max-width: 992px) {
    .productos-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columnas en tablets */
        gap: 20px;
    }
    
    .container {
        padding: 0 25px;
    }
    
    .page-header h1 {
        font-size: 2.5rem;
    }
    
    .buscador-productos {
        padding: 20px;
    }
    
    .buscador-input input,
    #filtroCategoria {
        padding: 14px 20px;
        font-size: 0.95rem;
    }
    
    .buscador-input input {
        padding-left: 45px;
    }
    
    .producto-imagen {
        height: 200px;
    }
    
    .producto-info {
        padding: 20px;
    }
    
    .producto-info h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .productos-grid {
        grid-template-columns: 1fr; /* 1 columna en móviles */
        gap: 20px;
    }
    
    .productos-page {
        padding: 100px 0 40px;
    }
    
    .page-header h1 {
        font-size: 2.2rem;
    }
    
    .page-header p {
        font-size: 1rem;
        padding: 0 20px;
    }
    
    .buscador-productos {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    
    .buscador-input,
    #filtroCategoria {
        width: 100%;
    }
    
    .producto-imagen {
        height: 220px; /* Ligeramente más grande en móviles para mejor visualización */
    }
    
    .producto-info h3 {
        font-size: 1.2rem;
    }
    
    .producto-info p {
        font-size: 0.9rem;
    }
    
    .btn-consultar {
        padding: 12px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .productos-page {
        padding: 90px 0 30px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .page-header h1 {
        font-size: 1.8rem;
    }
    
    .page-header p {
        font-size: 0.9rem;
        padding: 0 10px;
    }
    
    .buscador-productos {
        padding: 15px;
        margin-bottom: 30px;
    }
    
    .buscador-input input,
    #filtroCategoria {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .buscador-input input {
        padding-left: 40px;
    }
    
    .buscador-input i {
        font-size: 1rem;
        left: 12px;
    }
    
    .producto-imagen {
        height: 200px;
    }
    
    .producto-info {
        padding: 15px;
    }
    
    .producto-info h3 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }
    
    .producto-info p {
        font-size: 0.85rem;
        margin-bottom: 15px;
        -webkit-line-clamp: 2;
    }
    
    .btn-consultar {
        padding: 10px;
        font-size: 0.9rem;
        gap: 8px;
    }
    
    .btn-consultar i {
        font-size: 1rem;
    }
    
    .producto-card::after {
        font-size: 0.7rem;
        padding: 4px 12px;
    }
}

@media (max-width: 360px) {
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .producto-info h3 {
        font-size: 1rem;
    }
    
    .producto-info p {
        font-size: 0.8rem;
    }
    
    .btn-consultar {
        font-size: 0.85rem;
    }
    
    .producto-imagen {
        height: 180px;
    }
}

#productosContainer {
    min-height: 400px;
    transition: opacity 0.3s ease;
}

#productosContainer.loading {
    opacity: 0.6;
}