/* ==========================================================================
   1. VARIABLES GLOBALES (BRANDING INSTITUCIONAL)
   ========================================================================== */
:root {
    --primary-color: #0fa692;
    --primary-dark: #057a71;
    --primary-hover: #069488;
    --primary-light-bg: #e3f9f8;

    --secondary-blue: #0f5d97;
    --secondary-dark-blue: #1a548b;
    --blue-bg-light: #f2f8fd;

    --text-main: #4a5568;
    --text-muted: #667E99;
    --border-color: #D5E4F1;
    --bg-body: #f0f2f5;

    --transition-base: all 0.25s ease-in-out;
    --nav-offset: 60px;
}

/* ==========================================================================
   2. CONFIGURACIÓN BASE Y SCROLL
   ========================================================================== */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-body);
    font-size: 1rem;
}

body {
    font-family: 'Open Sans', 'Segoe UI', Roboto, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-body);
}

.min-w-0 {
    min-width: 0;
}

/* ==========================================================================
   3. PERFIL DE USUARIO (Grid/Flexbox)
   ========================================================================== */
.profile-user-info {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.profile-info-row {
    display: flex;
    align-items: center;
    border-top: 1px dotted var(--border-color);
}

.profile-info-row:first-child {
    border-top: none;
}

.profile-info-name {
    flex: 0 0 200px;
    text-align: right;
    padding: 10px 15px 10px 4px;
    font-weight: 500;
    color: var(--text-muted);
    background-color: transparent;
}

.profile-info-value {
    flex: 1;
    padding: 10px 6px;
    color: #333;
}

.profile-info-value>span+span:before {
    content: ",";
    margin: 0 4px 0 1px;
    color: #666;
}

.profile-info-value>span+span.editable-container:before {
    display: none;
}

.profile-user-info-striped .profile-info-name {
    color: #336199;
}

.profile-user-info-striped .profile-info-value {
    border-top: 1px dotted #ebeff1;
    padding-left: 15px;
}

@media (max-width: 576px) {
    .profile-info-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-info-name {
        flex: 1 1 auto;
        text-align: left;
        width: 100%;
        padding: 8px 4px 4px 10px;
        font-weight: 600;
    }

    .profile-info-value {
        width: 100%;
        padding: 4px 4px 8px 10px;
    }
}

/* ==========================================================================
   4. TARJETAS MODERNAS, COLORES Y UTILIDADES
   ========================================================================== */
/* Forzar que las tarjetas permitan contenido sobresaliente (Fix para selectores) */
.card-modern,
.card-pro,
.sidebar-section,
.page-content,
.main-content {
    overflow: visible !important;
}

.card-modern,
.card-pro {
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: var(--transition-base);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 5;
}

.card-modern:hover,
.card-pro:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.bgc-blue-d3,
.bgcj-primary {
    background: var(--blue-bg-light);
}

.bgcj-purple {
    background: var(--secondary-dark-blue);
}

.bgc-green-d2 {
    background-color: var(--primary-dark) !important;
}

.text-primary-d2 {
    color: #596b83 !important;
}

.text-primary,
.text-blue-d1 {
    color: var(--primary-color) !important;
}

.hover-green:hover {
    color: var(--primary-color) !important;
    text-decoration: underline !important;
}

/* Botones Brand */
.btn-primary {
    color: #fff;
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transition: var(--transition-base);
}

.btn-primary:hover,
.btn-primary:focus,
.show>.btn-primary.dropdown-toggle,
.btn-primary:active {
    color: #fff !important;
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    box-shadow: 0 4px 10px rgba(6, 148, 136, 0.3);
}

.btn-outline-info {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-info:hover {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-add-dashed {
    display: block;
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
}

.btn-add-dashed:hover {
    background-color: var(--primary-light-bg);
    text-decoration: none;
}

/* Badges y Dropdowns */
.badge-primary {
    background-color: var(--primary-color);
}

.badge-success {
    background-color: var(--primary-hover);
}

.badge-hero {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 6px 14px;
    font-weight: 500;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dropdown-menu-add {
    width: 450px;
    max-width: 90vw;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

.dropdown-menu-add .dropdown-item {
    padding: 10px 20px;
    transition: background 0.2s;
}

.dropdown-menu-add .dropdown-item:hover {
    background-color: var(--primary-light-bg);
    color: var(--primary-color);
}

.dropdown-menu-add .bg-light-custom {
    background-color: #f8f9fa;
}

/* Paginación y Filtros */
.page-link {
    color: var(--primary-color);
    transition: var(--transition-base);
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.filter-header {
    background: #f8fafc;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #edf2f7;
    font-weight: 600;
    color: var(--text-main);
}

.btn-toolbar-custom {
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 500;
    border: 0;
    transition: var(--transition-base);
}

.btn-filter {
    background-color: #e2e8f0;
    color: #475569;
}

.btn-filter:hover {
    background-color: #cbd5e1;
    color: #1e293b;
}

/* ==========================================================================
   5. COMPONENTES DE FORMULARIOS (Clásicos y Modernos)
   ========================================================================== */
/* Formularios Estilo Classroom Moderno */
.form-label-custom {
    font-weight: 600;
    color: #3c4043;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.form-control-custom {
    border-radius: 4px;
    border: 1px solid #dadce0;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.form-control-custom:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(15, 166, 146, 0.15);
}

.siaespdiv-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.siaespdiv-label {
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    font-size: 0.75rem;
    color: #5f6368;
    pointer-events: none;
    font-weight: 500;
}

.siaespdiv-input {
    background-color: #f1f3f4;
    border: none;
    border-bottom: 1px solid #80868b;
    border-radius: 4px 4px 0 0;
    padding: 1.5rem 1rem 0.5rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
}

.siaespdiv-input:focus {
    background-color: #e8eaed;
    border-bottom: 2px solid var(--primary-color);
    box-shadow: none;
    outline: none;
}

/* Floating Labels (Animados) */
.form-label-group {
    position: relative;
    margin-bottom: 1.25rem;
}

.form-label-group input.form-control,
.form-label-group select.form-control {
    height: 3rem;
    padding: 1rem 0.85rem 0.25rem;
    border-radius: 0.35rem;
    font-size: 0.95rem;
    transition: var(--transition-base);
}

.form-label-group label {
    position: absolute;
    top: 0;
    left: 0.75rem;
    padding: 0.8rem 0.25rem;
    color: #888;
    font-size: 0.95rem;
    pointer-events: none;
    background: transparent;
    transition: var(--transition-base);
    transform-origin: 0 0;
}

.form-label-group input::placeholder {
    color: transparent !important;
}

.form-label-group input:focus+label,
.form-label-group input:not(:placeholder-shown)+label,
.form-label-group select:focus+label,
.form-label-group select:valid+label,
.form-label-group .chosen-container-active+label,
.form-label-group .chosen-container-single:not(.chosen-container-active)+label {
    top: -0.6rem;
    left: 0.5rem;
    background: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0 0.4rem;
    color: var(--primary-color);
    z-index: 10;
    border-radius: 3px;
}

.form-label-group select:disabled+label,
.form-label-group .chosen-disabled+label {
    color: #aaa;
}

/* ==========================================================================
   6. HEADER Y BANNERS
   ========================================================================== */
.profile-header,
.profile-header-custom {
    position: relative;
    color: #fff;
    background-image: linear-gradient(135deg, rgba(5, 122, 112, 0.13) 0%, rgba(3, 85, 78, 0.329) 100%), url('../../img/imgsistema/fheader.svg');
    background-position: center center;
    background-size: cover;
}

.profile-header {
    overflow: hidden;
    padding: 3rem 2rem;
    margin-bottom: -2rem;
    isolation: isolate;
    box-shadow: 0 8px 25px rgba(5, 122, 113, 0.3);
}

.profile-header-custom {
    padding: 2rem;
}

.sticky-toolbar {
    position: sticky;
    top: var(--nav-offset);
    z-index: 1040;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.navbar-blue .navbar-intro {
    background-color: rgb(5, 4, 27);
}

/* ==========================================================================
   7. SIDEBAR Y NAVEGACIÓN
   ========================================================================== */
.sticky-sidebar-wrapper {
    position: sticky;
    top: calc(var(--nav-offset) + 70px);
    z-index: 1020;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

.teacher-avatar {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: #495057;
    font-weight: 500;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-menu li a i {
    width: 25px;
    color: #adb5bd;
}

.sidebar-menu li a:hover {
    background-color: var(--primary-light-bg);
    color: var(--primary-color);
}

.sidebar-menu li a:hover i {
    color: var(--primary-color);
}

.sidebar-white .nav>.nav-item.active>.nav-link,
.sidebar-white3 .nav>.nav-item.active>.nav-link {
    color: var(--primary-color);
    background-color: var(--primary-light-bg);
    font-weight: 600;
}

.sidebar-white .nav>.nav-item.active>.nav-link>.nav-icon {
    color: var(--primary-color);
}

.sidebar-white .nav>.nav-item.open>.nav-link {
    color: var(--primary-color);
    background-color: transparent;
}

.sidebar-white .nav>.nav-item>.nav-link:hover {
    background-color: var(--primary-light-bg);
    color: var(--primary-color);
}

.sidebar-white .nav>.nav-item>.nav-link:hover>.nav-icon {
    color: var(--primary-color);
}

.sidebar-white3 .nav.has-active-border .nav-item.active>.nav-link::before {
    content: "";
    border-color: var(--primary-color);
    top: 0.5rem;
    bottom: 0.5rem;
    margin-left: 2px;
    border-radius: 6px;
    border-width: 3px;
}

.sidebar-gradient1 {
    background-color: #2d5365;
    background-image: linear-gradient(180deg, var(--primary-dark) 0%, #226467 100%);
    --active-border-offset-right: 1px;
}

.sidebar-section {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.sidebar-section:last-child {
    border-bottom: none;
}

/* ==========================================================================
   8. LISTADO DE SEMANAS (Timeline)
   ========================================================================== */
.timeline-container {
    position: relative;
    margin-top: 1.5rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 2.5rem;
    transition: z-index 0s;
}

.timeline-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s, box-shadow 0.2s;
}

.timeline-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(15, 166, 146, 0.15);
    border-color: var(--primary-light-bg);
}

.timeline-card-header {
    background-color: #ffffff;
    border-bottom: 1px solid #f1f3f5;
    border-radius: 10px 10px 0 0;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-card-title {
    margin: 0;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
    text-transform: uppercase;
}

.timeline-act-row:last-child {
    border-bottom: none !important;
    border-radius: 0 0 10px 10px;
}

.timeline-act-row:hover {
    background-color: #fbfbfc !important;
}

/* Custom Scrollbar Menu */
.scroll-navigator {
    overflow-y: auto;
    padding-right: 5px;
    flex-grow: 1;
    max-height: 40vh;
}

.scroll-navigator::-webkit-scrollbar {
    width: 4px;
}

.scroll-navigator::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-navigator::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 10px;
}

/* ==========================================================================
   9. MEJORAS CHOSEN-JS Y DROPZONES (Archivos)
   ========================================================================== */
/* Fix para Chosen.js (Desplegables) */
.chosen-container {
    width: 100% !important;
}

.chosen-container-single .chosen-single {
    border-radius: 4px !important;
    border: 1px solid #dadce0 !important;
    height: 38px !important;
    line-height: 36px !important;
    background: #f8f9fa !important;
    box-shadow: none !important;
    color: #3c4043 !important;
    font-size: 0.95rem;
}

.chosen-single {
    font-size: 0.95rem;
    line-height: 2.25rem;
    height: 2.75rem;
    background: #ffffff;
    box-shadow: none;
    border-radius: 0.35rem;
}

/* Elevación de Prioridad para Listas Desplegables */
.chosen-container-active {
    z-index: 10000 !important;
}

.chosen-container-active.chosen-with-drop .chosen-single {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(15, 166, 146, 0.15) !important;
}

.chosen-container .chosen-drop {
    z-index: 10001 !important;
    border: 1px solid var(--primary-color) !important;
    border-top: 0 !important;
    border-radius: 0 0 8px 8px !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2) !important;
    background: #ffffff !important;
}

.chosen-container .chosen-results li.highlighted {
    background-color: var(--primary-color) !important;
    background-image: none !important;
    color: white !important;
}

/* Archivos y Dropzones */
.current-file-box {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 6px;
    transition: all 0.2s;
}

.current-file-box:hover {
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.siaesp-file-upload-box {
    border: 2px dashed #dadce0;
    background-color: #fff;
    border-radius: 6px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.siaesp-file-upload-box:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light-bg);
}

.siaesp-file-icon {
    font-size: 3rem;
    color: #a1a5b7;
    margin-bottom: 1rem;
    transition: color 0.2s ease;
}

.siaesp-file-upload-box:hover .siaesp-file-icon {
    color: var(--primary-color);
}

/* ==========================================================================
   10. AJUSTES RESPONSIVOS Y MODALES
   ========================================================================== */
.modal-lg {
    max-width: 800px;
    margin: 1.75rem auto;
}

.modal-backdrop.show {
    opacity: 0.65;
    background-color: var(--secondary-dark-blue);
}

.modal-content {
    background-color: #ffffff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background-color: var(--primary-light-bg);
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
}

/* ==========================================================================
   VARIANTE: ABRIR CHOSEN.JS HACIA ARRIBA (DROP-UP)
   ========================================================================== */
/* ==========================================================================
   FIX: CHOSEN.JS SIEMPRE ENCIMA DE LAS PESTAÑAS Y TARJETAS
   ========================================================================== */

/* 1. Evitar que la tarjeta contenedora corte el menú */
.card-modern,
.bgc-secondary-l4,
.card-body {
    overflow: visible !important;
}

/* 2. Elevar la tarjeta actual por encima de las demás cuando se interactúa con ella */
.card-modern:focus-within {
    z-index: 1050 !important;
    position: relative;
}

/* 3. Forzar el select activo por encima de todo el DOM */
.chosen-container-active.chosen-with-drop {
    z-index: 9999 !important;
}

/* 4. Estilos de la caja desplegable (flote libre y sombra fuerte) */
.chosen-container .chosen-drop {
    z-index: 9999 !important;
    position: absolute !important;
    border: 1px solid var(--primary-color) !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25) !important;
    background: #ffffff !important;
}

@media (max-width: 991.98px) {
    .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .card-modern,
    .card-pro {
        margin-left: 10px;
        margin-right: 10px;
        margin-bottom: 1rem;
    }

    .profile-header-custom {
        border-radius: 0;
    }
}

.toolbar-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #edf1f5;
}

.card-modern {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.main-content {
    overflow: visible !important;
}

.sidebar-light .nav>.nav-item.active>.nav-link {
    color: #2fb2ac;
    font-weight: 600;
}