/* ==========================================================================
   1. VARIABLES GLOBALES Y RESET BÁSICO (TEMA VIRTUAL+)
   ========================================================================== */

:root {
    /* Nueva Paleta de Colores "Virtual+" */
    --color-primario: #8a5ff2;        /* Violeta del Logo */
    --color-acento: #64ffda;          /* Cian Eléctrico del Logo */
    --color-fondo: #0a192f;           /* Azul Marino Profundo */
    --color-texto: #ccd6f6;           /* Gris Claro */
    --color-texto-secundario: #8892b0; /* Gris Pizarra */
    --color-superficie: #112240;      /* Un azul ligeramente más claro para tarjetas y headers */
    
    /* Colores base */
    --color-blanco: #FFFFFF;
    --sombra-suave: 0 4px 15px rgba(0, 0, 0, 0.2);

    /* Fuentes que se mantienen */
    --fuente-titulos: 'Montserrat', sans-serif;
    --fuente-cuerpo: 'Roboto', sans-serif;

    /* Actualizamos el color del botón para que use el nuevo acento */
    --color-btn-add: var(--color-acento);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--fuente-cuerpo);
    background-color: var(--color-fondo);
    color: var(--color-texto);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--color-acento);
}

/* ==========================================================================
   2. ENCABEZADO Y NAVEGACIÓN (HEADER)
   ========================================================================== */

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--color-superficie);
    border-bottom: 1px solid #233554;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Contenedor del logo y nombre */
.site-name {
    display: flex;
    align-items: center;
    font-family: var(--fuente-titulos);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-texto);
}

.header-logo {
    height: 40px; /* Tamaño ajustado para proporción */
    margin-right: 10px;
}

/* Barra de Búsqueda */
.search-container {
    display: flex;
    align-items: center;
    background-color: var(--color-fondo);
    border: 1px solid #233554;
    border-radius: 50px;
    padding: 0 1rem;
    width: 50%;
}

.search-container .search-icon {
    color: var(--color-texto-secundario);
    margin-right: 0.75rem;
}

.search-container input[type="search"] {
    width: 100%;
    border: none;
    outline: none;
    padding: 0.8rem 0;
    font-size: 1rem;
    background: transparent;
    color: var(--color-texto);
}

.search-container .category-filter {
    border: none;
    outline: none;
    background: transparent;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    color: var(--color-texto-secundario);
    border-left: 1px solid #233554;
    margin-left: 0.5rem;
}

/* ==========================================================================
   3. MENÚ DE PERFIL DE USUARIO (UNIFICADO)
   ========================================================================== */

.user-profile-container {
    position: relative;
}

.user-profile-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 1.8rem;
    color: var(--color-texto-secundario);
    display: flex;
    transition: color 0.3s ease;
}

.user-profile-button:hover {
    color: var(--color-acento);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 55px;
    right: 0;
    background-color: var(--color-superficie);
    border-radius: 8px;
    box-shadow: var(--sombra-suave);
    border: 1px solid #233554;
    width: 220px;
    z-index: 1100;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid #233554;
}
.dropdown-header strong { display: block; color: var(--color-texto); }
.dropdown-header small { color: var(--color-texto-secundario); }

.dropdown-item {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--color-texto);
    text-decoration: none;
    transition: background-color 0.2s;
}
.dropdown-item:hover {
    background-color: var(--color-fondo);
}
.dropdown-item i {
    margin-right: 10px;
    color: var(--color-texto-secundario);
}

/* ==========================================================================
   4. SECCIÓN HERO (BIENVENIDA)
   ========================================================================== */

.hero-section {
    background-color: rgba(0, 0, 0, 0.2); /* Fondo consistente con el resto de la página */
    padding: 100px 2rem;
    text-align: center;
}

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

.hero-section h1 {
    font-family: var(--fuente-titulos);
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--color-texto);
}

.hero-section p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: var(--color-texto-secundario);
}

.cta-button {
    background-color: var(--color-acento);
    color: #0a192f;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(100, 255, 218, 0.1);
}

/* ==========================================================================
   5. CONTENIDO PRINCIPAL Y CUADRÍCULA DE CURSOS
   ========================================================================== */

.main-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.course-category h2 {
    font-family: var(--fuente-titulos);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--color-acento);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* ==========================================================================
   6. TARJETA DE CURSO (COURSE CARD)
   ========================================================================== */

.course-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.course-card {
    background-color: var(--color-superficie);
    border-radius: 10px;
    box-shadow: none;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: 1px solid #233554;
}

.course-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.course-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.course-card .card-content {
    padding: 1rem;
}

.course-card h3 {
    font-family: var(--fuente-titulos);
    font-size: 1.2rem;
    margin: 0;
    color: var(--color-texto);
}

/* ==========================================================================
   7. ESTILOS DE MODALES (LOGIN, REGISTRO, ETC.)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 25, 47, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: var(--color-superficie);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 400px;
    position: relative;
    border: 1px solid #233554;
}

.modal-content .close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.8rem;
    color: var(--color-texto-secundario);
    cursor: pointer;
}

.modal-content h2 {
    font-family: var(--fuente-titulos);
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--color-texto);
}

.modal-content form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-texto-secundario);
}

.modal-content form input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #233554;
    border-radius: 5px;
    font-size: 1rem;
    background-color: var(--color-fondo);
    color: var(--color-texto);
}

.modal-content form .login-submit-btn {
    width: 100%;
    padding: 0.8rem;
    border: none;
    background-color: var(--color-acento);
    color: var(--color-fondo);
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.modal-content p {
    text-align: center;
    margin-top: 1rem;
    color: var(--color-texto-secundario);
}

.form-options {
    text-align: right;
    margin-bottom: 1rem;
    font-size: 0.9em;
}

.modal-description {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--color-texto-secundario);
}

/* ==========================================================================
   8. ESTILOS PARA EL ICONO DE MOSTRAR CONTRASEÑA
   ========================================================================== */

.password-input-container {
    position: relative;
}

.password-input-container input {
    padding-right: 40px; 
}

.password-input-container i {
    position: absolute;
    right: 15px;
    top: 38%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--color-texto-secundario);
}

/* ==========================================================================
   9. PÁGINA DE DETALLES DEL CURSO
   ========================================================================== */

.course-detail-container {
    display: flex;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    gap: 2rem;
}

.course-main-content {
    flex: 3;
}

.course-playlist {
    flex: 1;
    background-color: var(--color-superficie);
    border-radius: 10px;
    padding: 1.5rem;
    height: fit-content;
    border: 1px solid #233554;
}

.video-player-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 10px;
}

.video-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.course-title {
    font-family: var(--fuente-titulos);
    font-size: 2.5rem;
    margin-top: 2rem;
}

.instructor-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    font-size: 1.1rem;
}

.category-tag {
    background-color: var(--color-primario);
    color: var(--color-blanco);
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 0.9em;
}

.course-description {
    margin-top: 2rem;
}

.playlist-header {
    margin-bottom: 1.5rem;
}

.playlist-header h3 {
    margin-bottom: 1rem;
}

.enroll-button {
    width: 100%;
    padding: 1rem;
    border: none;
    background-color: var(--color-btn-add);
    color: var(--color-fondo);
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.enroll-button:hover {
    opacity: 0.85;
}

.course-playlist ul {
    list-style: none;
    padding: 0;
    max-height: 500px;
    overflow-y: auto;
}

.course-playlist li {
    padding: 0.8rem;
    border-bottom: 1px solid #233554;
    cursor: pointer;
    transition: background-color 0.2s;
}

.course-playlist li:hover {
    background-color: var(--color-fondo);
}

.course-playlist li.active {
    background-color: rgba(100, 255, 218, 0.1);
    color: var(--color-acento);
    font-weight: bold;
}

.course-playlist li i {
    margin-right: 10px;
}

/* ==========================================================================
   10. VISTA CONDICIONAL DEL CURSO (BLOQUEADO/INSCRITO)
   ========================================================================== */

.preview-block {
    background-color: var(--color-superficie);
    border: 2px dashed #233554;
    border-radius: 10px;
    padding: 3rem;
    text-align: center;
    margin-top: 2rem;
}
.preview-block .fa-lock {
    font-size: 3rem;
    color: var(--color-texto-secundario);
    margin-bottom: 1rem;
}
.preview-block h2 {
    font-family: var(--fuente-titulos);
    font-size: 1.8rem;
}
.enroll-button-main {
    background-color: var(--color-btn-add);
    color: var(--color-fondo);
    padding: 1rem 2.5rem;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    margin-top: 1rem;
    transition: opacity 0.3s ease;
}
.enroll-button-main:hover {
    opacity: 0.85;
}

.vista-publica .enrolled-content { display: none; }
.vista-inscrito .preview-block { display: none; }
.vista-inscrito .enroll-button { display: none; }

/* ==========================================================================
   11. PANEL DE USUARIO (MIS CURSOS)
   ========================================================================== */

.dashboard-header {
    background-color: var(--color-superficie);
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    border: 1px solid #233554;
}

.dashboard-header h1 {
    font-family: var(--fuente-titulos);
    font-size: 2.2rem;
    margin: 0;
}

.dashboard-header p {
    font-size: 1.1rem;
    color: var(--color-texto-secundario);
}

.empty-state {
    background-color: var(--color-superficie);
    border-radius: 10px;
    padding: 3rem;
    text-align: center;
    margin-top: 2rem;
    border: 1px solid #233554;
}

.empty-state .fa-book-open {
    font-size: 4rem;
    color: var(--color-acento);
    opacity: 0.5;
    margin-bottom: 1.5rem;
}

.empty-state h2 {
    font-family: var(--fuente-titulos);
    font-size: 1.8rem;
}

.empty-state p {
    font-size: 1.1rem;
    color: var(--color-texto-secundario);
    margin-bottom: 2rem;
}

.empty-state { display: none; }
body.no-courses .empty-state { display: block; }
body.no-courses .user-courses-content { display: none; }


/* ==========================================================================
   12. PIE DE PÁGINA (FOOTER)
   ========================================================================== */

.main-footer {
    background-color: #020c1b;
    color: var(--color-texto-secundario);
    padding-top: 3rem;
    margin-top: 4rem;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    gap: 2rem;
}

.footer-column {
    flex: 1;
}

.footer-column:first-child {
    flex: 2;
}

.footer-column h3 {
    font-family: var(--fuente-titulos);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-texto);
}

.footer-column h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--color-acento);
    padding-bottom: 0.5rem;
    display: inline-block;
    color: var(--color-texto);
}

.footer-column a, .footer-column p {
    color: var(--color-texto-secundario);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.footer-column a:hover {
    color: var(--color-acento);
}

.social-icons a {
    display: inline-block;
    margin-right: 1rem;
    font-size: 1.5rem;
}

.footer-bottom {
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    background-color: rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   13. PÁGINAS ESTÁTICAS (SOBRE NOSOTROS, LEGAL, ETC.)
   ========================================================================== */

.static-page-container {
    background-color: var(--color-superficie);
    padding: 2.5rem;
    border-radius: 10px;
    border: 1px solid #233554;
    max-width: 800px;
    margin: 0 auto;
}

.static-page-container h1 {
    font-family: var(--fuente-titulos);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--color-acento);
}

.static-page-container h2 {
    font-family: var(--fuente-titulos);
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--color-texto-secundario);
    padding-bottom: 0.5rem;
}

.static-page-container p {
    line-height: 1.8;
    color: var(--color-texto-secundario);
}

.content-section:not(:last-child) {
    margin-bottom: 4rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #233554;
}