/* ===============================
   ESTILOS: MATERIAL DE DIVULGACIÓN
   =============================== */

/* Contenedor general */
.contenedor-material {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Filtros */
.filtros-material {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    align-items: center;
}

.filtros-material input,
.filtros-material select {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    background: #fff;
    transition: all 0.3s ease;
}

.filtros-material input:focus,
.filtros-material select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.filtros-material input {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23666"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>');
    background-repeat: no-repeat;
    background-position: 15px center;
    background-size: 20px;
    padding-left: 45px;
}

/* Grilla principal */
.grid-material {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

/* Tarjetas */
.tarjeta-material {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-align: left;
    border: 1px solid #e1e1e1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tarjeta-material:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Imagen o visor PDF */
.imagen-material {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
}

.imagen-material img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.tarjeta-material:hover .imagen-material img {
    transform: scale(1.05);
}

.imagen-material iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Información del material */
.info-material {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.info-material h3 {
    font-size: 1.2em;
    margin: 0 0 12px 0;
    color: #2c3e50;
    line-height: 1.4;
    font-weight: 600;
}

.info-material p {
    font-size: 0.9em;
    color: #555;
    margin: 4px 0;
    line-height: 1.5;
}

.info-material strong {
    color: #333;
    font-weight: 600;
}

/* Contador de descargas o vistas */
.contador-clicks {
    font-weight: bold;
    color: #0066cc;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    font-size: 0.95em;
}

/* Enlaces */
.info-material a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.3s ease;
}

.info-material a:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Estado cuando está filtrado */
.tarjeta-material[style*="none"] {
    display: none !important;
}

/* Mensaje cuando no hay resultados */
.grid-material:empty::after {
    content: "No se encontraron materiales que coincidan con los filtros.";
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1200px) {
    .contenedor-material {
        padding: 15px;
    }
    
    .grid-material {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .filtros-material {
        flex-direction: column;
    }
    
    .filtros-material input,
    .filtros-material select {
        min-width: 100%;
        width: 100%;
    }
    
    .grid-material {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 15px;
    }
    
    .imagen-material {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .contenedor-material {
        padding: 10px;
    }
    
    .grid-material {
        grid-template-columns: 1fr;
    }
    
    .imagen-material {
        height: 160px;
    }
    
    .info-material {
        padding: 15px;
    }
}