/* ==========================================================================
   MATERIALES ÓPTICOS - ESTRUCTURA CON IMAGEN EN HEADER
   ========================================================================== */

/* Variables específicas para materiales */
:root {
    --material-card-radius: 12px;
    --material-shadow: 0 8px 30px rgba(133, 95, 49, 0.12);
    --material-shadow-hover: 0 15px 40px rgba(133, 95, 49, 0.18);
    --material-border: 1px solid rgba(133, 95, 49, 0.12);
    --material-transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

/* Hero Section Específico */
.bg-materiales-hero {
    background: linear-gradient(135deg, var(--dark-color) 0%, #4a4a4a 100%);
    padding: 80px 0 60px;
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
}

.bg-materiales-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
}

.bg-materiales-hero h2 {
    color: white;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    position: relative;
}

.bg-materiales-hero .lead {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.3rem;
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

/* Contenedor Principal */
.materiales-main {
    padding: 30px 0 80px;
    background: #f9f9f9;
}

.material-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-top: 40px;
}

/* Tarjeta de Material con nueva estructura */
.material-card {
    background: white;
    border-radius: var(--material-card-radius);
    overflow: hidden;
    box-shadow: var(--material-shadow);
    transition: var(--material-transition);
    border: var(--material-border);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.material-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--material-shadow-hover);
    border-color: rgba(133, 95, 49, 0.25);
}

/* Header con imagen, número y título en horizontal */
.material-card-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 25px;
    background: linear-gradient(135deg, rgba(133, 95, 49, 0.05) 0%, rgba(194, 181, 155, 0.05) 100%);
    border-bottom: 2px solid rgba(133, 95, 49, 0.1);
}

/* Contenedor de imagen pequeña */
.material-header-image {
    flex-shrink: 0;
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 10px;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.material-header-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 10px;
    transition: transform 0.5s ease;
}

.material-card:hover .material-header-image img {
    transform: scale(1.1);
}

/* Badge sobre imagen */
.material-image-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(133, 95, 49, 0.3);
    border: 3px solid white;
}

/* Video badge en imagen */
.material-video-badge {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 170, 0, 0.95);
    color: var(--dark-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 3px 10px rgba(255, 170, 0, 0.3);
    z-index: 2;
    white-space: nowrap;
}

/* Información del header */
.material-header-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.material-title {
    color: var(--dark-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.material-subtitle {
    color: var(--secondary-color);
    font-size: 1rem;
    font-weight: 400;
    margin: 0;
}

.material-code {
    display: inline-block;
    background: var(--primary-light);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    align-self: flex-start;
}

/* Placeholder para imagen */
.material-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: var(--secondary-color);
    padding: 20px;
}

.material-image-placeholder i {
    font-size: 2rem;
    color: var(--primary-light);
    margin-bottom: 10px;
}

.material-image-placeholder span {
    font-size: 0.85rem;
    text-align: center;
}

/* Contenido principal */
.material-card-body {
    padding: 30px;
    flex-grow: 1;
}

/* Descripción del material */
.material-description {
    color: var(--secondary-color);
    line-height: 1.7;
    font-size: 1.05rem;
    margin-bottom: 25px;
}

.material-description p {
    margin-bottom: 15px;
}

.material-description ul, 
.material-description ol {
    padding-left: 20px;
    margin-bottom: 15px;
}

.material-description li {
    margin-bottom: 8px;
}

/* Especificaciones en grid */
.material-specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 30px;
    padding: 25px;
    background: rgba(133, 95, 49, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(133, 95, 49, 0.08);
}

.spec-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid rgba(133, 95, 49, 0.1);
    transition: var(--transition);
}

.spec-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(133, 95, 49, 0.1);
}

.spec-icon {
    width: 45px;
    height: 45px;
    background: var(--primary-light);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.spec-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--dark-color);
}

/* Footer de la tarjeta */
.material-card-footer {
    padding: 20px 30px;
    border-top: 1px solid rgba(133, 95, 49, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    background: rgba(133, 95, 49, 0.02);
}

.material-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.material-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-material-action {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    text-decoration: none;
}

.btn-material-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(133, 95, 49, 0.3);
    color: white;
}

.btn-material-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-light);
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    text-decoration: none;
}

.btn-material-secondary:hover {
    background: var(--primary-light);
    color: white;
    transform: translateY(-3px);
}

/* Separador entre materiales */
.material-divider {
    text-align: center;
    position: relative;
    height: 40px;
    margin: 20px 0;
}

.material-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(133, 95, 49, 0.3), transparent);
}

.divider-icon {
    position: relative;
    background: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    border: 2px solid rgba(133, 95, 49, 0.2);
    z-index: 1;
}

/* Contador de materiales */
.materiales-counter {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(133, 95, 49, 0.1);
    margin: 40px 0;
}

.materiales-counter i {
    font-size: 2rem;
    color: var(--primary-color);
}

.counter-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
}

.counter-number {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.4rem;
    font-weight: 700;
}

/* Grid de características */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature-card {
    background: white;
    padding: 35px 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-top: 5px solid var(--primary-color);
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-md);
}

.feature-icon-wrapper {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    color: white;
    font-size: 2rem;
}

/* CTA Mejorado */
.material-cta {
    background: linear-gradient(135deg, var(--dark-color) 0%, #4a4a4a 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
    border-radius: 20px;
    margin: 60px 0;
    position: relative;
    overflow: hidden;
}

.material-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="circles" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100%" height="100%" fill="url(%23circles)"/></svg>');
}

.material-cta-content {
    position: relative;
    z-index: 2;
}

.material-cta h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: white;
}

.material-cta p {
    font-size: 1.2rem;
    margin-bottom: 35px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-buttons .btn {
    padding: 14px 35px;
    font-size: 1.1rem;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
    min-width: 220px;
}

/* Responsive */
@media (max-width: 992px) {
    .material-card-header {
        flex-direction: column;
        text-align: center;
        gap: 25px;
    }
    
    .material-header-info {
        align-items: center;
    }
    
    .material-code {
        align-self: center;
    }
    
    .material-specs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .bg-materiales-hero {
        padding: 60px 0 40px;
    }
    
    .bg-materiales-hero h2 {
        font-size: 2.2rem;
    }
    
    .material-title {
        font-size: 1.6rem;
    }
    
    .material-specs-grid {
        grid-template-columns: 1fr;
    }
    
    .material-card-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .material-actions {
        justify-content: center;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .cta-buttons .btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 576px) {
    .material-header-image {
        width: 100px;
        height: 100px;
    }
    
    .material-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-material-action,
    .btn-material-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* Estados vacíos */
.no-materials-message {
    background: white;
    padding: 60px 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 2px dashed rgba(133, 95, 49, 0.2);
}

.no-materials-message i {
    font-size: 4rem;
    color: var(--primary-light);
    margin-bottom: 20px;
    display: block;
}

.no-materials-message h3 {
    color: var(--dark-color);
    margin-bottom: 15px;
}

/* Animaciones */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.material-card {
    animation: slideInUp 0.6s ease forwards;
}

/* Retrasos escalonados */
.material-card:nth-child(1) { animation-delay: 0.1s; }
.material-card:nth-child(2) { animation-delay: 0.2s; }
.material-card:nth-child(3) { animation-delay: 0.3s; }
.material-card:nth-child(4) { animation-delay: 0.4s; }
.material-card:nth-child(5) { animation-delay: 0.5s; }