/* static/css/style.css */

/* --- Estructura General y Tipografía --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa;
    color: #343a40;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

h1, h2, h4, h5 {
    font-weight: 600;
}

/* --- Contenedor Principal Unificado --- */
.main-content-container {
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.07);
    margin: 20px auto;
    max-width: 1400px;
    width: 95%;
}

.full-page-container {
    margin: 0;
    padding: 2rem;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
    border-top: 1px solid #dee2e6;
}


/* --- Contenedor para Login/Registro --- */
.auth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    align-items: center;
}

.auth-form {
    padding-right: 20px;
}

.auth-image-container {
    height: 100%;
    min-height: 400px;
    border-radius: 12px;
    overflow: hidden;
}

.auth-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* --- Barra de Navegación --- */
.navbar {
    background-color: #ffffff !important;
}

.navbar-brand {
    color: #0d6efd !important;
}

.navbar-logo {
    height: 30px;
    width: auto;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    padding: 0.3em 0.5em;
    font-size: 0.7em;
}

/* --- Tarjetas de Cursos --- */
.course-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: none;
    border-radius: 12px;
    cursor: grab; /* Indica que se puede arrastrar */
}
.course-card:active {
    cursor: grabbing;
}


/* --- Estilo para Drag-and-Drop --- */
.sortable-ghost {
    opacity: 0.4;
    background: #c8ebfb;
}

.card-title {
    font-weight: 700;
}

/* --- Botones --- */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

/* --- Footer --- */
.footer {
    font-size: 0.9em;
}

/* --- Botones de Administración Sobrios --- */
.btn-admin {
    padding: 0.25rem 0.5rem;
    font-size: .875em;
    border-radius: 5px;
    transition: all 0.2s ease-in-out;
}

.btn-admin-promote {
    color: #198754;
    border: 1px solid #198754;
    background-color: transparent;
}
.btn-admin-promote:hover {
    color: #fff;
    background-color: #198754;
}

.btn-admin-demote {
    color: #6c757d;
    border: 1px solid #6c757d;
    background-color: transparent;
}
.btn-admin-demote:hover {
    color: #fff;
    background-color: #6c757d;
}

.btn-admin-delete {
    color: #dc3545;
    border: 1px solid #dc3545;
    background-color: transparent;
}
.btn-admin-delete:hover {
    color: #fff;
    background-color: #dc3545;
}

/* --- Estilos para Filtros y Etiquetas de Categoría --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.filter-btn {
    border-radius: 20px;
    padding: 0.25rem 0.8rem;
    font-size: 0.85rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    transition: all 0.2s ease-in-out;
}
.filter-btn:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
}
.filter-btn.active {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}
.course-card-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    min-height: 25px;
}
.category-tag {
    font-size: 0.75rem;
    padding: 0.2em 0.6em;
    border-radius: 10px;
    background-color: #e9ecef;
    color: #495057;
}

/* --- Estilos para la página de visualización de contenido --- */
.content-viewer {
    width: 100%;
    height: 75vh;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.video-responsive-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 8px;
}

.video-responsive-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.text-content-body {
    padding: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
    height: auto;
}

/* --- Dashboard Alumno --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* --- Foros y Comunicados --- */
.forum-thread-card {
    transition: box-shadow 0.2s ease-in-out;
}
.forum-thread-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.announcement-card {
    border-left: 4px solid #0d6efd;
}

/* --- Tareas y Calificaciones --- */
.submission-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    transition: box-shadow 0.2s;
}
.submission-card:hover {
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.grade-badge {
    min-width: 60px;
    font-size: 0.9rem;
    font-weight: bold;
}

/* --- Gamificación / Insignias --- */
.achievement-badge {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.achievement-badge img {
    width: 60px;
    height: 60px;
}
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
.achievement-card {
    text-align: center;
    padding: 1.5rem;
    border: 1px solid #dee2e6;
    border-radius: 12px;
}
.achievement-card img {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
}

/* --- Ajuste para el ícono del acordeón en Perfil --- */
.accordion-button {
    position: relative;
}

.accordion-button::after {
    display: none; /* Oculta la flecha por defecto de Bootstrap */
}

.accordion-arrow {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s ease-in-out;
}

.accordion-button:not(.collapsed) .accordion-arrow {
    transform: translateY(-50%) rotate(-180deg);
}

/* --- Estilos para el Chat --- */
.chat-container {
    display: grid;
    grid-template-columns: 320px 1fr; /* Columna fija para contactos, el resto para el chat */
    height: calc(100vh - 150px); /* Ajusta la altura para que quepa en la pantalla */
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 12px;
    overflow: hidden;
}

#user-sidebar {
    background-color: #f8f9fa; /* Un fondo ligeramente distinto para separar */
    border-right: 1px solid var(--border-color, #dee2e6);
    display: flex;
    flex-direction: column;
}
#user-sidebar h4 {
    padding: 1.25rem;
    margin: 0;
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

#user-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}
#user-list li {
    padding: 1rem 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color, #dee2e6);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background-color 0.2s;
}
#user-list li:hover {
    background-color: #e9ecef;
}
#user-list li.selected {
    background-color: #0d6efd;
    color: white;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #6c757d; /* Offline por defecto */
    transition: background-color 0.3s;
}
.status-indicator.online {
    background-color: #198754; /* Verde para online */
}

#chat-main {
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

#chat-welcome {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    color: #6c757d;
}
#chat-welcome i {
    font-size: 4em;
    margin-bottom: 1rem;
}

#chat-window {
    display: none; /* Oculto por defecto */
    flex-direction: column;
    height: 100%;
}

#chat-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color, #dee2e6);
    font-weight: 600;
}

#messages {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    line-height: 1.4;
}
.sent {
    background-color: #0d6efd;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.received {
    background-color: #e9ecef;
    color: #343a40;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

#chat-form {
    display: flex;
    padding: 1rem;
    border-top: 1px solid var(--border-color, #dee2e6);
    gap: 0.75rem;
}
#message-input {
    flex-grow: 1;
    border: 1px solid #ced4da;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 1rem;
}
#message-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
/* --- EN static/css/style.css --- */

#messages {
    height: calc(100vh - 750px); /* Altura fija para el contenedor de mensajes */
    padding: 1.5rem;
    overflow-y: auto; /* Muestra el scroll vertical SÓLO si es necesario */
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* --- Estilos para la sección de Examen en Módulos --- */
.module-quiz-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Espacio entre la nota y los botones */
}
/* =========================================
   AJUSTES MÓVILES (RESPONSIVE PRO)
   ========================================= */

@media (max-width: 768px) {
    
    /* 1. Héroe / Landing: Texto más chico y márgenes */
    .landing-hero h1 {
        font-size: 2.5rem !important; /* Achica el título gigante */
    }
    .landing-hero p.lead {
        font-size: 1.2rem !important; /* Achica el subtítulo */
        padding: 0 15px; /* Margen a los costados para que no toque el borde */
    }

    /* 2. Botones del Landing (Comenzar / Ver Cursos) */
    .landing-hero .d-grid, 
    .landing-hero .d-sm-flex {
        display: flex !important;
        flex-direction: column; /* Uno abajo del otro */
        gap: 15px !important; /* Espacio entre botones */
        padding: 0 20px; /* Margen para que no toquen los bordes de la pantalla */
    }

    .landing-hero .btn {
        width: 100% !important; /* Que ocupen todo el ancho disponible */
        font-size: 1.1rem;
        padding: 12px 0; /* Botones más altos (mejor para el dedo) */
    }

    /* 3. Tarjetas de Cursos (Cards) */
    .course-card {
        margin-bottom: 20px; /* Más espacio entre tarjeta y tarjeta */
    }

    /* 4. Botones del Menú (Navbar) al abrirse en celular */
    .navbar-collapse .nav-item {
        text-align: center; /* Centrar enlaces */
        margin-bottom: 10px;
    }
    .navbar-collapse .btn {
        width: 100%; /* Botón "Registrarse" ancho completo */
        margin-top: 5px;
    }
}

/* =========================================
   ESTILO COURSERA / PRO DASHBOARD
   ========================================= */

/* Colores Base */
:root {
    --coursera-blue: #0056D2;
    --coursera-hover: #00419e;
    --coursera-text: #1f1f1f;
    --coursera-border: #d1d7dc;
    --coursera-bg: #FFFFFF;
}

/* Contenedor Principal Estilo Tarjeta Limpia */
.coursera-card {
    background: var(--coursera-bg);
    border: 1px solid var(--coursera-border);
    border-radius: 8px; /* Bordes ligeramente redondeados, no mucho */
    box-shadow: none !important; /* Coursera es plano */
    padding: 32px !important;
    margin-top: 2rem;
}

/* Botones Estilo Coursera */
.btn-coursera-primary {
    background-color: var(--coursera-blue);
    color: white;
    border: 1px solid var(--coursera-blue);
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border-radius: 4px; /* Botones más cuadrados */
    transition: background-color 0.2s;
}

.btn-coursera-primary:hover {
    background-color: var(--coursera-hover);
    color: white;
}

/* Pestañas (Tabs) Limpias - Solo texto y linea azul */
.coursera-tabs {
    border-bottom: 1px solid #e1e1e1;
    gap: 20px;
}

.coursera-tabs .nav-link {
    border: none;
    background: transparent;
    color: #636363;
    font-weight: 600;
    padding: 10px 0;
    margin-bottom: -1px; /* Para que la línea pise el borde */
    border-bottom: 2px solid transparent;
}

.coursera-tabs .nav-link:hover {
    color: var(--coursera-blue);
}

.coursera-tabs .nav-link.active {
    color: var(--coursera-blue);
    background: transparent;
    border-bottom: 2px solid var(--coursera-blue);
}

/* Tablas Minimalistas */
.coursera-table thead th {
    background-color: white;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #636363;
    border-bottom: 1px solid var(--coursera-border);
    padding-bottom: 1rem;
}

.coursera-table tbody td {
    padding: 1.2rem 0.5rem;
    color: var(--coursera-text);
    border-bottom: 1px solid #f5f5f5;
}

.coursera-table tr:hover td {
    background-color: #fcfcfc;
}

/* Avatares de Aulas */
.tenant-avatar {
    width: 40px;
    height: 40px;
    background-color: #eff5ff; /* Azul muy claro */
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cce0ff;
}

/* Badges (Etiquetas) Personalizadas */
.coursera-badge {
    padding: 4px 8px;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}
.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}
.badge-active {
    background-color: #e0e7ff;
    color: #3730a3;
}
.badge-inactive {
    background-color: #f3f4f6;
    color: #4b5563;
}

/* Botón Panel SaaS en el Menú */
.btn-coursera-nav {
    background-color: #0056D2; /* Azul Coursera */
    color: white !important;
    font-weight: 600;
    border-radius: 4px;
    padding: 0.4rem 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: 1px solid #0056D2;
    transition: background-color 0.2s;
}

.btn-coursera-nav:hover {
    background-color: #00419e; /* Azul más oscuro al pasar mouse */
    color: white !important;
}

/* Botón Panel SaaS Sutil (Estilo Outline) */
.btn-coursera-subtle {
    color: #0056D2 !important; /* Texto Azul */
    background-color: transparent;
    border: 1px solid #0056D2; /* Borde Fino Azul */
    font-weight: 600;
    border-radius: 4px;
    padding: 0.3rem 0.8rem; /* Un poco más pequeño y elegante */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
}

.btn-coursera-subtle:hover {
    background-color: #f0f7ff; /* Fondo azul muy clarito al pasar el mouse */
    color: #00419e !important;
    border-color: #00419e;
}