/* ============== RESET Y ESTILOS BASE ============== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 20px;
}

/* Tipografía principal y fondo degradado sutil */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #1e293b;
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Enlaces y botones con cursor pointer */
a { 
    text-decoration: none; 
    color: inherit; 
    cursor: pointer;
}
img { 
    max-width: 100%; 
    height: auto; 
    display: block; 
}
button, a { cursor: pointer; }

/* Contenedor centrado máximo 1200px */
.container {
    width: min(90%, 1200px);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============== BARRA DE PROGRESO ============== */
.progress-container {
    position: fixed;
    top: 0; 
    left: 0; 
    right: 0;
    height: 6px;
    background: rgba(30,64,175,.1);
    z-index: 9999;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    width: 0%;
    transition: width 0.4s ease;
    box-shadow: 0 0 15px rgba(59,130,246,.6);
}

/* ============== HEADER ============== */
.header {
    background: #ffffff;
    padding: 1rem 0;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    position: sticky;
    top: 0;
    z-index: 998;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(59,130,246,.15);
}

/* Distribución del logo y menú */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-weight: 800;
    font-size: 1.35rem;
    color: #1e40af;
}

.logo img {
    height: 45px;
    transition: transform .3s ease;
    border-radius: 8px;
}

.logo:hover img {
    transform: scale(1.08);
}

/* Navegación */
.nav-list {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: #475569;
    font-weight: 600;
    padding: .6rem 1.2rem;
    border-radius: 12px;
    transition: all .3s ease;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .95rem;
    position: relative;
}

.nav-link:hover {
    background: rgba(59,130,246,.12);
    color: #1d4ed8;
    transform: translateY(-2px);
}

.nav-link.active {
    background: #1e40af !important;
    color: white !important;
    font-weight: 700;
    box-shadow: 0 3px 12px rgba(30,64,175,0.4);
}

.nav-link.active:hover {
    background: #1e3a8a !important;
}

.nav-link.active .nav-icon {
    color: white;
}

.nav-icon {
    font-size: 1rem;
    color: #64748b;
    transition: color 0.25s ease;
}

/* Hamburguesa CSS-only */
#nav-checkbox { 
    display: none; 
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #475569;
    cursor: pointer;
    padding: 8px;
}

/* ============== MAIN CONTENT ============== */
main {
    flex: 1;
    padding: 3rem 0 4rem;
    margin-top: 1rem;
}

.intro {
    margin-top: 2rem;
    margin-bottom: 4rem;
}

/* Títulos de sección */
.section-title {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: #1e293b;
    position: relative;
    font-weight: 800;
    padding-bottom: 1rem;
    text-align: center;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 5px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 3px;
}

/* ============== INTRO CARD ============== */
.intro-card {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 50px rgba(30,58,138,.15);
    border: 1px solid rgba(59,130,246,.1);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    margin-bottom: 4rem;
}

.intro-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.intro-text h1 {
    font-size: 2.5rem;
    color: #1e40af;
    margin-bottom: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.intro-text p {
    font-size: 1.2rem;
    color: #475569;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.intro-text strong {
    color: #1e40af;
    font-weight: 700;
}

.info {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
}

.info span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-weight: 600;
    background: rgba(59,130,246,.08);
    padding: 0.5rem 1rem;
    border-radius: 10px;
}

.start-btn {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    color: white;
    padding: 1.2rem 2.5rem;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all .4s ease;
    box-shadow: 0 10px 30px rgba(59,130,246,.4);
    width: fit-content;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(59,130,246,.6);
    color: white;
}

.video-container {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,.2);
    aspect-ratio: 16 / 9;
    background: #f1f5f9;
}

.video-embed {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ============== TOPICS GRID ============== */
.topics {
    margin: 4rem 0;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.topic-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 15px 40px rgba(30,58,138,.1);
    border: 1px solid rgba(59,130,246,.1);
    transition: all .4s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.topic-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(30,58,138,.2);
    border-color: rgba(59,130,246,.3);
}

.topic-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    color: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 10px 25px rgba(59,130,246,.3);
    transition: all .4s ease;
}

.topic-card:hover .icon {
    transform: scale(1.1) rotate(5deg);
}

.topic-card h3 {
    font-size: 1.4rem;
    color: #1e293b;
    margin: 0;
    font-weight: 700;
    line-height: 1.3;
}

.topic-card p {
    color: #64748b;
    line-height: 1.7;
    margin: 0;
    flex-grow: 1;
    font-size: 1.05rem;
}

.start-topic-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    background: rgba(59,130,246,.1);
    color: #1d4ed8;
    padding: 1rem 2rem;
    border-radius: 14px;
    font-weight: 600;
    transition: all .3s ease;
    border: 2px solid transparent;
    width: fit-content;
    margin: 0 auto;
}

.start-topic-btn:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-2px);
    border-color: #3b82f6;
}

/* ============== FOOTER ============== */
.footer {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #cbd5e1;
    padding: 3rem 0 2rem;
    margin-top: auto;
    text-align: center;
}

.footer .container {
    max-width: 1200px;
}

.footer-logos {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.footer-logos img {
    height: 60px;
    filter: brightness(0) invert(1);
    opacity: 0.9;
    transition: all .4s ease;
    border-radius: 8px;
}

.footer-logos img:hover {
    opacity: 1;
    transform: translateY(-5px);
}

.footer p {
    text-align: center;
    margin: .6rem 0;
    font-weight: 500;
    color: #cbd5e1;
}

.footer a {
    color: #60a5fa;
    font-weight: 600;
}

.back-top {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    background: rgba(96,165,250,.3);
    color: white;
    padding: .8rem 1.6rem;
    border-radius: 14px;
    margin-top: 1.5rem;
    transition: all .4s ease;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.back-top:hover {
    background: rgba(96,165,250,.5);
    transform: translateY(-4px);
    color: white;
}

/* ============== ANIMACIONES ============== */
.fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* ============== COMPATIBILIDAD CON BOOTSTRAP ============== */
.navbar {
    background: transparent !important;
    padding: 0 !important;
}

.navbar-collapse {
    flex-grow: 0 !important;
}

.navbar-nav {
    flex-direction: row !important;
}

.navbar-toggler {
    display: none !important;
}

.row {
    --bs-gutter-x: 0 !important;
}

.card {
    border: none !important;
    background: transparent !important;
}

/* ============== RESPONSIVE DESIGN ============== */
@media (max-width: 992px) {
    .intro-card {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }
    
    .info {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .intro-content {
        align-items: center;
    }
    
    .intro-text h1 {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    main {
        padding: 2rem 0 3rem;
        margin-top: 0.5rem;
    }
    
    .intro { 
        margin-top: 1rem; 
        margin-bottom: 3rem;
    }
    
    .header-content { 
        padding: 0 1rem; 
    }
    
    .nav-list { 
        gap: 0.5rem; 
    }
    
    .section-title { 
        font-size: 2rem; 
        margin-bottom: 2rem;
    }
    
    .intro-card {
        padding: 2rem;
        margin-bottom: 3rem;
    }
    
    .intro-text h1 {
        font-size: 2rem;
    }
    
    .intro-text p {
        font-size: 1.1rem;
    }
    
    .topics-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .topic-card {
        padding: 2rem;
    }
    
    /* Menú hamburguesa móvil */
    .nav-toggle { 
        display: block; 
    }

    .nav-list {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        align-items: center;
        padding: 1.5rem 0;
        gap: 0.5rem;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 8px 20px rgba(0,0,0,0.08);
        transform: translateY(-150%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.35s ease;
        z-index: 997;
    }

    #nav-checkbox:checked ~ .nav-list {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-link {
        width: 90%;
        justify-content: center;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        margin: 0.2rem 0;
    }
}

@media (max-width: 480px) {
    .container {
        width: 95%;
        padding: 0 0.5rem;
    }
    
    .intro-card, 
    .topic-card { 
        padding: 1.5rem; 
    }
    
    .footer-logos { 
        gap: 1.5rem; 
    }
    
    .footer-logos img { 
        height: 50px; 
    }
    
    .logo img { 
        height: 40px; 
    }
    
    .intro-text h1 {
        font-size: 1.8rem;
    }
    
    .info {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    .info span {
        justify-content: center;
        width: 100%;
    }
    
    .start-btn,
    .start-topic-btn {
        width: 100%;
        justify-content: center;
    }
    
    .icon {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }
    
    .topic-card h3 {
        font-size: 1.3rem;
    }
}
/* ============== CORRECCIÓN DE ENLACES ENTRE MÓDULOS ============== */

/* Estilos para los botones de comenzar módulo */
.start-btn {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    color: white;
    padding: 1.2rem 2.5rem;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all .4s ease;
    box-shadow: 0 10px 30px rgba(59,130,246,.4);
    width: fit-content;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(59,130,246,.6);
    color: white;
    text-decoration: none;
}

/* Estilos para los botones de comenzar tema */
.start-topic-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    background: rgba(59,130,246,.1);
    color: #1d4ed8;
    padding: 1rem 2rem;
    border-radius: 14px;
    font-weight: 600;
    transition: all .3s ease;
    border: 2px solid transparent;
    width: fit-content;
    margin: 0 auto;
    text-decoration: none;
    cursor: pointer;
}

.start-topic-btn:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-2px);
    border-color: #3b82f6;
    text-decoration: none;
}

/* Indicador visual del módulo activo */
.nav-link.active {
    background: #1e40af !important;
    color: white !important;
    font-weight: 700;
    box-shadow: 0 3px 12px rgba(30,64,175,0.4);
}

/* Mejoras para la navegación entre módulos */
.nav-link {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #3b82f6;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

.nav-link.active::after {
    width: 90%;
    background: white;
}

/* ============== MEJORAS DE USABILIDAD ============== */

/* Feedback visual para enlaces */
a:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 8px;
}

/* Estados de carga para botones */
.start-btn.loading,
.start-topic-btn.loading {
    position: relative;
    color: transparent;
}

.start-btn.loading::after,
.start-topic-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.start-topic-btn.loading::after {
    border-top: 2px solid #1d4ed8;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============== RESPONSIVE PARA ENLACES ============== */
@media (max-width: 768px) {
    .start-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
        width: 100%;
        justify-content: center;
    }
    
    .start-topic-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
        width: 100%;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .start-btn {
        padding: 0.875rem 1.5rem;
    }
    
    .start-topic-btn {
        padding: 0.75rem 1.25rem;
    }
}