/* ===== VARIABLES ===== */
:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --accent: #f093fb;
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #f44336;
    
    /* Light theme */
    --bg-main: #f5f7fa;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --text-main: #2c3e50;
    --text-muted: #64748b;
    --border-color: rgba(102, 126, 234, 0.2);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 60px rgba(102, 126, 234, 0.25);
}

[data-theme="dark"] {
    --bg-main: #0f0c29;
    --bg-card: rgba(30, 30, 60, 0.7);
    --bg-card-hover: rgba(40, 40, 80, 0.85);
    --text-main: #f0f0f0;
    --text-muted: #a0aec0;
    --border-color: rgba(102, 126, 234, 0.3);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 20px 60px rgba(102, 126, 234, 0.4);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.5s ease;
}

/* ===== FONDO ANIMADO ===== */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: floatShape 20s infinite ease-in-out;
}

[data-theme="light"] .bg-shape {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="dark"] .bg-shape {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.2;
}

.shape-1 { width: 500px; height: 500px; top: -150px; left: -150px; }
.shape-2 { width: 400px; height: 400px; bottom: -100px; right: -100px; animation-delay: -5s; }
.shape-3 { width: 350px; height: 350px; top: 40%; left: 60%; animation-delay: -10s; }

@keyframes floatShape {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(80px, -80px) scale(1.1); }
    66% { transform: translate(-60px, 60px) scale(0.9); }
}

#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ===== BANNER ===== */
.test-banner {
    background: linear-gradient(135deg, var(--error), #c0392b);
    color: white;
    text-align: center;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.9em;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* ===== HEADER ===== */
.main-header {
    position: fixed;
    top: 38px;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    transition: all 0.3s ease;
}

.main-header.scrolled {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .main-header.scrolled {
    background: rgba(15, 12, 41, 0.85);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.2em;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.logo-text {
    font-size: 1.1em;
}

.logo-accent {
    color: var(--primary);
}

.main-nav {
    display: flex;
    gap: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    text-decoration: none;
    color: var(--text-main);
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95em;
}

.nav-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.nav-icon {
    font-size: 1.1em;
}

.theme-toggle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    cursor: pointer;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text-main);
}

.theme-toggle:hover {
    transform: rotate(180deg) scale(1.1);
    background: var(--primary);
    color: white;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.mobile-menu-btn span {
    width: 25px;
    height: 3px;
    background: var(--text-main);
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* ===== PAGE HERO ===== */
.page-hero {
    padding: calc(108px + 60px) 20px 80px;
    text-align: center;
    position: relative;
}

.page-hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.page-badge {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 50px;
    font-weight: 600;
    margin-bottom: 20px;
}

.page-title {
    font-size: clamp(2em, 5vw, 3.5em);
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1.2em;
    margin-bottom: 30px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    padding: 25px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow);
    max-width: 500px;
    margin: 0 auto;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2.5em;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-label {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 5px;
}

.stat-divider {
    width: 2px;
    height: 50px;
    background: var(--border-color);
}

/* ===== FILTERS SECTION ===== */
.filters-section {
    padding: 0 20px 40px;
}

.filters-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.search-box {
    position: relative;
    margin-bottom: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    color: var(--text-muted);
}

#courseSearch {
    width: 100%;
    padding: 15px 20px 15px 50px;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 1em;
    font-family: 'Poppins', sans-serif;
    background: var(--bg-card-hover);
    color: var(--text-main);
    transition: all 0.3s ease;
}

#courseSearch:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-filter {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: var(--bg-card-hover);
    color: var(--text-main);
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.btn-filter:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.btn-filter.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* ===== COURSES SECTION ===== */
.courses-section {
    padding: 40px 20px 80px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-tag {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 15px;
}

.section-title {
    font-size: clamp(1.8em, 4vw, 2.8em);
    font-weight: 800;
    margin-bottom: 15px;
}

.section-line {
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    margin: 0 auto;
    border-radius: 2px;
}

/* ===== MODULES GRID ===== */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.module-item {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

.module-item.hidden {
    display: none;
}

.module-card {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    transition: all 0.4s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.module-item:hover .module-card {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.module-item:hover .card-glow {
    opacity: 1;
}

.module-item.active-course .module-card {
    border: 2px solid var(--success);
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.3);
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 10px;
}

.module-code {
    display: inline-block;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.module-badge {
    padding: 4px 10px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    border-radius: 15px;
    font-size: 0.75em;
    font-weight: 600;
}

.module-badge.status-available {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.module-name {
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-main);
    line-height: 1.3;
}

.module-description {
    color: var(--text-muted);
    font-size: 0.95em;
    margin-bottom: 20px;
    flex-grow: 1;
    line-height: 1.6;
}

.module-status {
    margin-bottom: 15px;
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.status-construction {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning);
}

.status-ready {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success);
}

.btn-access {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-access:hover:not(.disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.btn-access.disabled {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

.btn-arrow {
    transition: transform 0.3s ease;
}

.btn-access:hover:not(.disabled) .btn-arrow {
    transform: translateX(5px);
}

/* ===== FOOTER ===== */
.main-footer {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: 40px 20px;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.btn-back-footer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 25px;
    background: var(--bg-card-hover);
    color: var(--primary);
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.btn-back-footer:hover {
    background: var(--primary);
    color: white;
    transform: translateX(-5px);
    border-color: var(--primary);
}

.footer-copy {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* ===== BACK TO TOP ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
}

/* ===== ANIMATIONS ===== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .main-nav {
        position: fixed;
        top: 108px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 20px;
        gap: 10px;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-link {
        justify-content: center;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(8px, -8px);
    }
    
    .hero-stats {
        gap: 20px;
    }
    
    .stat-divider {
        display: none;
    }
    
    .filter-buttons {
        flex-direction: column;
    }
    
    .btn-filter {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .header-content {
        padding: 0 15px;
    }
    
    .logo-text {
        display: none;
    }
    
    .page-hero {
        padding: calc(108px + 40px) 15px 60px;
    }
    
    .filters-container {
        padding: 20px;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .module-card {
        padding: 25px;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}