:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
    --light-bg: #f8f9fa;
    --text: #333;
    --white: #ffffff;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    background-color: var(--light-bg);
    color: var(--text);
}

.test-banner {
    background: var(--accent);
    color: white;
    text-align: center;
    padding: 8px;
    font-weight: bold;
    font-size: 0.85em;
}

header {
    background: var(--primary);
    color: white;
    padding: 3rem 1rem;
    text-align: center;
}

nav {
    background: var(--white);
    display: flex;
    justify-content: center;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav a {
    text-decoration: none;
    color: var(--primary);
    margin: 0 15px;
    font-weight: 600;
}

nav a.active {
    color: var(--secondary);
    border-bottom: 2px solid var(--secondary);
}

.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 20px;
}

/* Filtros */
.filter-container {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#courseSearch {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
}

.btn-filter {
    padding: 8px 20px;
    border: none;
    background: #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-filter.active {
    background: var(--secondary);
    color: white;
}

/* Grid de Cursos */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.module-item {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-top: 5px solid var(--secondary);
}

.module-code {
    font-weight: bold;
    color: var(--secondary);
}

.module-name {
    font-size: 1.25rem;
    margin: 10px 0;
    font-weight: 700;
}

.btn-access {
    display: block;
    text-align: center;
    background: var(--primary);
    color: white;
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    margin-top: 15px;
    transition: background 0.3s;
}

.btn-access:hover {
    background: var(--secondary);
}

footer {
    text-align: center;
    padding: 2rem;
    color: #888;
}

/* Estilo para botones desactivados */
.btn-access.disabled {
    background-color: #bdc3c7 !important; /* Gris claro */
    cursor: not-allowed;
    pointer-events: none; /* Evita que el enlace funcione */
    opacity: 0.7;
}

.module-item:has(.disabled) {
    border-top-color: #bdc3c7; /* Cambia el borde superior a gris */
    filter: grayscale(0.5); /* Hace que toda la tarjeta se vea un poco más apagada */
}

/* Estilos para la tarjeta con foto en el grid */
.module-item.ativo-con-foto {
    display: flex;
    flex-direction: column; /* Imagen arriba, texto abajo */
    padding: 0; /* Quitamos padding para que la foto llegue al borde */
    overflow: hidden;
}

.course-card-img {
    width: 100%;
    height: 150px; /* Altura fija para la miniatura */
    object-fit: cover; /* Recorta la imagen para que encaje bien */
    border-bottom: 5px solid var(--secondary); /* Mantenemos la línea azul */
}

/* Volvemos a dar padding al contenido de texto */
.module-item.ativo-con-foto .module-content {
    padding: 1.5rem;
}