:root {
    --ql-primary: #2a41e8;
    --ql-primary-strong: #1d2fb8;
    --ql-primary-soft: #edf1ff;
    --ql-ink: #202434;
    --ql-muted: #667085;
    --ql-subtle: #98a2b3;
    --ql-border: #e2e7ef;
    --ql-border-strong: #cdd5df;
    --ql-nav-bg: #0b0b10;
    --ql-brand-indigo: #4f51f3;
    --ql-brand-purple: #6e2bf5;
    --ql-brand-gradient: linear-gradient(135deg, var(--ql-brand-indigo) 0%, var(--ql-brand-purple) 100%);
    --ql-danger-strong: #e21b3c;
    --ql-tooltip-bg: #1b1d2a;
    --ql-sidebar-width: 286px;
    --ql-sidebar-width-collapsed: 84px;

    /* Teselas de colores */
    --ql-tile-pink: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
    --ql-tile-red: linear-gradient(135deg, #dc2626 0%, #f87171 100%);
    --ql-tile-orange: linear-gradient(135deg, #ea580c 0%, #fb923c 100%);
    --ql-tile-yellow: linear-gradient(135deg, #d97706 0%, #fbbf24 100%);
    --ql-tile-green: linear-gradient(135deg, #16a34a 0%, #4ade80 100%);
    --ql-tile-blue: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
    --ql-tile-purple: linear-gradient(135deg, #7c3aed 0%, #c084fc 100%);
}

/* ==========================================================================
   QL SIDEBAR COMPONENT (Replica Mockup 2.1.0)
   ========================================================================== */

.ql-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--ql-sidebar-width);
    z-index: 1050;
    background: var(--ql-nav-bg);
    display: flex;
    flex-direction: column;
    transition: width .28s cubic-bezier(.16, 1, .3, 1), flex-basis .28s cubic-bezier(.16, 1, .3, 1), transform .25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .25);
    user-select: none;
    font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Contenedor de navegación */
.ql-sidebar__nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 16px 14px 24px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
}

.ql-sidebar__nav::-webkit-scrollbar {
    width: 0;
}

/* Rótulos de grupo */
.ql-sidebar__label {
    margin: 0;
    padding: 14px 12px 6px;
    color: rgba(255, 255, 255, .4);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ql-sidebar__rule {
    display: none;
    width: 32px;
    height: 1px;
    margin: 14px auto 10px;
    background: rgba(255, 255, 255, .12);
}

/* Enlaces */
.ql-sidebar__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 9px 12px;
    border-radius: 12px;
    color: rgba(255, 255, 255, .72);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.ql-sidebar__link:hover {
    background: rgba(255, 255, 255, .08);
    color: #ffffff !important;
}

.ql-sidebar__link.is-active {
    background: rgba(255, 255, 255, .14);
    color: #ffffff !important;
    font-weight: 700;
}

.ql-sidebar__link.is-active::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -8px;
    width: 4px;
    height: 22px;
    border-radius: 0 4px 4px 0;
    background: var(--ql-brand-gradient);
    transform: translateY(-50%);
}

/* Teselas de icono */
.ql-sidebar__tile {
    position: relative;
    display: flex;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    opacity: .88;
    transition: opacity .15s ease, transform .15s ease;
    color: #fff;
}

.ql-sidebar__link:hover .ql-sidebar__tile,
.ql-sidebar__link.is-active .ql-sidebar__tile {
    opacity: 1;
    transform: scale(1.04);
}

.ql-sidebar__tile svg,
.ql-sidebar__tile ion-icon,
.ql-sidebar__tile i {
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: #fff;
    display: block;
}

/* Clases de colores de teselas */
.ql-tile--pink { background: var(--ql-tile-pink); }
.ql-tile--red { background: var(--ql-tile-red); }
.ql-tile--orange { background: var(--ql-tile-orange); }
.ql-tile--yellow { background: var(--ql-tile-yellow); }
.ql-tile--green { background: var(--ql-tile-green); }
.ql-tile--blue { background: var(--ql-tile-blue); }
.ql-tile--purple { background: var(--ql-tile-purple); }

/* Texto */
.ql-sidebar__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    color: inherit;
}

/* Badges y contadores */
.ql-sidebar__count {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 1px 8px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.ql-sidebar__count.is-alert {
    background: var(--ql-danger-strong);
    box-shadow: 0 2px 6px rgba(226, 27, 60, .4);
}

.ql-sidebar__dot {
    position: absolute;
    top: -3px;
    right: -3px;
    display: none;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border: 2px solid var(--ql-nav-bg);
    border-radius: 9999px;
    background: var(--ql-danger-strong);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 12px;
    text-align: center;
}

.ql-sidebar__dot.is-soft {
    background: #5b5f7a;
}

/* Badges contadores rojos en menús desplegables del header (Pendientes) */
.notification-counter {
    margin-left: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.counter-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 24px !important;
    padding: 2px 8px !important;
    border-radius: 9px !important;
    background-color: #e53935 !important;
    color: #ffffff !important;
    font-size: 12px !important;
    font-weight: bold !important;
    line-height: 1.4 !important;
    text-align: center !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}



/* Botón colapsar / expandir (Toggle) en la barra superior */
.ql-nav-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    margin: 0 16px 0 0 !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, .12) !important;
    color: rgba(255, 255, 255, .9) !important;
    cursor: pointer !important;
    font-size: 18px !important;
    transition: background .18s ease, color .18s ease, transform .15s ease !important;
    flex-shrink: 0 !important;
}

.ql-nav-toggle:hover {
    background: rgba(255, 255, 255, .25) !important;
    color: #ffffff !important;
    transform: scale(1.04) !important;
}

.ql-nav-toggle svg {
    width: 20px !important;
    height: 20px !important;
}

/* Alineación de la barra superior (Header Left Side) */
header .header_inner {
    padding-left: 14px !important;
}

header .header_inner .left-side {
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
}

header .header_inner .left-side #logo {
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 16px 0 0 !important;
}

header .header_inner .left-side #logo img {
    height: 32px !important;
    max-width: 140px !important;
    width: auto !important;
    object-fit: contain !important;
}

.ql-nav-toggle__expand { display: none; }
.ql-nav-toggle__collapse { display: inline-flex; }

/* Telón de fondo móvil */
.ql-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1040;
    display: none;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    border: 0;
    padding: 0;
    margin: 0;
}

/* Tooltip flotante en colapsado */
.ql-float-tip {
    position: fixed;
    z-index: 2100;
    max-width: 250px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--ql-tooltip-bg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    color: #ffffff;
    font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    pointer-events: none;
    transform: translateY(-50%);
    white-space: normal;
    border: 1px solid rgba(255, 255, 255, .1);
}

/* Tooltips CSS nativos basados en data-tip (Design System QuizLab 2.1) */
[data-tip] {
    position: relative;
}

[data-tip]:after {
    content: attr(data-tip);
    position: absolute;
    z-index: 1200;
    width: max-content;
    max-width: 250px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--ql-tooltip-bg, #1b1d2a);
    box-shadow: 0 8px 24px rgba(11, 11, 16, 0.4);
    color: #ffffff;
    font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .005em;
    line-height: 1.35;
    text-align: left;
    text-transform: none;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease, visibility .15s ease, transform .15s ease;
    transition-delay: .2s;
    border: 1px solid rgba(255, 255, 255, .08);
}

[data-tip]:hover:after,
[data-tip]:focus-visible:after {
    opacity: 1;
    visibility: visible;
}

.tip-r:after {
    top: 50%;
    left: calc(100% + 10px);
    transform: translateY(-50%);
}

.tip-b:after {
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}

.tip-bl:after {
    top: calc(100% + 8px);
    right: 0;
}


/* ==========================================================================
   DESKTOP (min-width: 761px)
   ========================================================================== */

@media (min-width: 761px) {
    /* Asegurar que el sidebar de visualización de artículos (course-watch) se muestre correctamente */
    .course-watch:not(.is-sidebar-collapsed) .sidebar,
    .course-watch:not(.is-sidebar-collapsed) .sidebar:not(.ql-sidebar),
    .course-watch .sidebar {
        display: block !important;
        position: relative !important;
        height: auto !important;
        min-height: 100vh !important;
        z-index: 20 !important;
    }

    .course-watch.is-sidebar-collapsed .sidebar,
    .is-sidebar-collapsed .course-watch .sidebar {
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        margin-left: -1px !important;
        padding: 0 !important;
        opacity: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        pointer-events: none !important;
        border-right: none !important;
    }


    /* MODO COLAPSADO (DESKTOP) */
    body.ql-nav-collapsed .ql-sidebar {
        width: var(--ql-sidebar-width-collapsed) !important;
    }

    body.ql-nav-collapsed .ql-sidebar__nav {
        align-items: center !important;
        padding: 16px 8px !important;
    }

    body.ql-nav-collapsed .ql-sidebar__label {
        display: none !important;
    }

    body.ql-nav-collapsed .ql-sidebar__rule {
        display: block !important;
    }

    body.ql-nav-collapsed .ql-sidebar__link {
        justify-content: center !important;
        gap: 0 !important;
        width: 48px !important;
        padding: 8px 0 !important;
    }

    body.ql-nav-collapsed .ql-sidebar__link.is-active::before {
        left: -10px !important;
    }

    body.ql-nav-collapsed .ql-sidebar__text,
    body.ql-nav-collapsed .ql-sidebar__count {
        display: none !important;
    }

    body.ql-nav-collapsed .ql-sidebar__dot {
        display: block !important;
    }

    body.ql-nav-collapsed .ql-nav-toggle__collapse {
        display: none !important;
    }

    body.ql-nav-collapsed .ql-nav-toggle__expand {
        display: inline-flex !important;
    }

    /* ==========================================================================
       AJUSTE GLOBAL DE CONTENEDORES PARA DAR ESPACIO AL SIDEBAR & HEADER
       ========================================================================== */

    /* 1. Contenedor principal #wrapper en todas las páginas (perfil, listados, sesiones, cursos) en Desktop */
    body:has(.ql-sidebar) #wrapper:not(.course-watch),
    body:has(.ql-sidebar) #wrapper.horizontal,
    body:has(.ql-header) #wrapper:not(.course-watch),
    body:has(.ql-header) #wrapper.horizontal,
    .ql-sidebar ~ #wrapper:not(.course-watch),
    .ql-header ~ #wrapper:not(.course-watch) {
        margin-left: var(--ql-sidebar-width) !important;
        width: calc(100% - var(--ql-sidebar-width)) !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding-top: var(--ql-header-height) !important;
        transition: margin-left .28s cubic-bezier(.16, 1, .3, 1), width .28s cubic-bezier(.16, 1, .3, 1) !important;
    }

    body.ql-nav-collapsed:has(.ql-sidebar) #wrapper:not(.course-watch),
    body.ql-nav-collapsed:has(.ql-sidebar) #wrapper.horizontal,
    body.ql-nav-collapsed:has(.ql-header) #wrapper:not(.course-watch),
    body.ql-nav-collapsed:has(.ql-header) #wrapper.horizontal,
    body.ql-nav-collapsed .ql-sidebar ~ #wrapper:not(.course-watch),
    body.ql-nav-collapsed .ql-header ~ #wrapper:not(.course-watch) {
        margin-left: var(--ql-sidebar-width-collapsed) !important;
        width: calc(100% - var(--ql-sidebar-width-collapsed)) !important;
        padding-top: var(--ql-header-height) !important;
    }


    /* 2. Resetear márgenes redundantes dentro de #wrapper */
    #wrapper .main_content,
    #wrapper .page-content,
    #wrapper #content_wrapper,
    #wrapper .is-collapse .main_content,
    #wrapper .is-small .main_content {
        margin-left: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding-top: 0 !important;
    }

    /* 3. Fallback para elementos sueltos fuera de #wrapper */
    body:not(:has(#wrapper)) .main_content,
    body:not(:has(#wrapper)) .page-content,
    body:not(:has(#wrapper)) #content_wrapper {
        margin-left: var(--ql-sidebar-width) !important;
        width: calc(100% - var(--ql-sidebar-width)) !important;
        padding-top: var(--ql-header-height) !important;
        transition: margin-left .28s cubic-bezier(.16, 1, .3, 1), width .28s cubic-bezier(.16, 1, .3, 1);
    }

    body.ql-nav-collapsed:not(:has(#wrapper)) .main_content,
    body.ql-nav-collapsed:not(:has(#wrapper)) .page-content,
    body.ql-nav-collapsed:not(:has(#wrapper)) #content_wrapper {
        margin-left: var(--ql-sidebar-width-collapsed) !important;
        width: calc(100% - var(--ql-sidebar-width-collapsed)) !important;
    }

    /* 4. Ajustes específicos para vistas de perfil y contenedores fluidos */
    body:has(.ql-sidebar) .profile-page-container,
    body:has(.ql-header) .profile-page-container {
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: 95% !important;
        width: 95% !important;
        margin-top: 15px !important;
        padding-top: 0 !important;
    }

    /* Ajuste de Topbar / Header si está fijo a la izquierda */
    header.is-transparent,
    header.is-dark,
    header.is-transparent2,
    header.is-dark2,
    header:not(.ql-header) {
        left: var(--ql-sidebar-width) !important;
        width: calc(100% - var(--ql-sidebar-width)) !important;
        transition: left .28s cubic-bezier(.16, 1, .3, 1), width .28s cubic-bezier(.16, 1, .3, 1);
    }

    body.ql-nav-collapsed header:not(.ql-header),
    body.ql-nav-collapsed .ql-header {
        left: var(--ql-sidebar-width-collapsed) !important;
        width: calc(100% - var(--ql-sidebar-width-collapsed)) !important;
    }

    /* Cuando no hay sidebar o en modo examen / simulador, el header abarca el 100% */
    body:not(:has(.ql-sidebar)) header:not(.ql-header),
    body:not(:has(.ql-sidebar)) .ql-header,
    .ql-header--exam-mode,
    body.ql-exam-mode .ql-header,
    body.ql-exam-mode header {
        left: 0 !important;
        width: 100% !important;
    }
}

/* ==========================================================================
   QL HEADER / NAVBAR (Mockup System 2.1.0)
   ========================================================================== */
:root {
    --ql-header-height: 64px;
    --ql-topbar-bg: #000000;
}

.ql-header {
    position: fixed;
    top: 0;
    left: var(--ql-sidebar-width);
    right: 0;

    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    height: var(--ql-header-height);
    padding: 0 24px;
    background: var(--ql-topbar-bg) !important;
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
    transition: left .28s cubic-bezier(.16, 1, .3, 1), width .28s cubic-bezier(.16, 1, .3, 1);
    font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
    box-sizing: border-box;
}

.ql-header__lead {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex-shrink: 0;
}

.ql-header__lead .ql-nav-toggle {
    margin: 0 !important;
}

.ql-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none !important;
}

.ql-brand:hover {
    color: #fff;
}

.ql-brand__logo {
    display: block;
    height: 32px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

.ql-header__sep {
    display: inline-block;
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, .18);
    flex-shrink: 0;
}

.ql-header__title {
    color: #ffffff;
    font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ql-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.ql-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .09);
    color: #ffffff;
    cursor: pointer;
    transition: background .18s ease, transform .15s ease, color .18s ease;
}

.ql-icon-btn:hover {
    background: rgba(255, 255, 255, .2);
    color: #ffffff;
    transform: scale(1.05);
}

.ql-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
}

.ql-icon-btn__badge {
    position: absolute;
    top: -3px;
    right: -5px;
    min-width: 18px;
    padding: 1px 5px;
    border: 2px solid var(--ql-topbar-bg);
    border-radius: 9999px;
    background: var(--ql-danger-strong);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
}

.ql-header__pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 9999px;
    background: #ffffff;
    color: #1a1a2e !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}

.ql-header__pill:hover {
    color: #1a1a2e !important;
    transform: scale(1.03);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
}

.ql-header__pill svg {
    color: #2ab200;
    width: 17px;
    height: 17px;
}

.ql-header__avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ql-brand-gradient);
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    border: 0;
    padding: 0;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 2px 8px rgba(79, 81, 243, .35);
}

.ql-header__avatar:hover {
    transform: scale(1.05);
}

.ql-header__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Dropdowns in header */
.ql-header-drop {
    border-radius: 14px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2) !important;
    border: 1px solid rgba(0, 0, 0, .06) !important;
    overflow: hidden !important;
    z-index: 1100 !important;
}

/* ==========================================================================
   QL LANGUAGE DROPDOWN
   ========================================================================== */
.ql-lang-dropdown {
    width: 270px !important;
    padding: 0 !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .06) !important;
    border: 1px solid #e2e8f0 !important;
    overflow: hidden !important;
}

.ql-lang-dropdown__header {
    padding: 14px 16px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.ql-lang-dropdown__subtitle {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
    display: block;
    margin-bottom: 8px;
}

.ql-lang-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ql-lang-current__info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ql-lang-flag {
    width: 24px;
    height: 17px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
    flex-shrink: 0;
}

.ql-lang-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    display: block;
    line-height: 1.2;
}

.ql-lang-code {
    font-size: 10.5px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.ql-lang-badge-active {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 700;
}

.ql-lang-dropdown__divider {
    height: 1px;
    background: #e2e8f0;
    width: 100%;
}

.ql-lang-dropdown__body {
    padding: 12px 14px 14px;
}

.ql-lang-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.ql-lang-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 10px;
    text-decoration: none !important;
    color: inherit;
    transition: all .15s ease;
    background: #f8fafc;
    border: 1px solid #edf2f7;
}

.ql-lang-item:hover {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    transform: translateX(2px);
}

.ql-lang-item__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ql-lang-item__texts {
    display: flex;
    flex-direction: column;
}

.ql-lang-item__name {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    display: block;
    line-height: 1.2;
    transition: color .15s ease;
}

.ql-lang-item__sub {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    display: block;
    transition: color .15s ease;
}

.ql-lang-item:hover .ql-lang-item__name {
    color: #2563eb !important;
}

.ql-lang-item:hover .ql-lang-item__sub {
    color: #3b82f6 !important;
}

.ql-lang-item__arrow {
    color: #94a3b8;
    transition: transform .15s ease, color .15s ease;
    display: flex;
    align-items: center;
}

.ql-lang-item:hover .ql-lang-item__arrow {
    color: #2563eb;
    transform: translateX(3px);
}

/* Padding superior global para evitar solapamiento con el Header fijo (64px) en Desktop y Mobile */
body:has(.ql-header) #wrapper:not(.course-watch),
body:has(.ql-header) #wrapper.horizontal,
.ql-header ~ #wrapper:not(.course-watch),
body:has(.ql-header) .main_content:not(#wrapper *),
body:has(.ql-header) .page-content:not(#wrapper *),
body:has(.ql-header) #content_wrapper:not(#wrapper *) {
    padding-top: var(--ql-header-height, 64px) !important;
    box-sizing: border-box !important;
}

body:has(.ql-header) #wrapper:not(.course-watch) .main_content,
body:has(.ql-header) #wrapper:not(.course-watch) #content_wrapper {
    padding-top: 0 !important;
}

body:has(.ql-header) .main_content .page-content,
body:has(.ql-header) .main_content .mockup-home-content,
body:has(.ql-header) .main_content .page-content.mockup-home-content {
    padding-top: 12px !important;
}

body:has(.ql-header) .milestone-banner {
    margin-top: 0 !important;
}


/* ==========================================================================
   QUIZLAB LIGHT THEME (HEADER_CONFIG_PROVIDER=quizlab)
   ========================================================================== */

/* 1. Header en modo QuizLab */
.ql-header.ql-header--quizlab,
.ql-header--quizlab {
    background: #ffffff !important;
    color: #1e293b !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .05) !important;
}

.ql-header--quizlab .ql-header__title {
    color: #0f172a !important;
    font-weight: 800 !important;
}

.ql-header--quizlab .ql-header__sep {
    background: #e2e8f0 !important;
}

.ql-header--quizlab .ql-nav-toggle {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
}

.ql-header--quizlab .ql-nav-toggle:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

.ql-header--quizlab .ql-icon-btn {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
}

.ql-header--quizlab .ql-icon-btn:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

.ql-header--quizlab .ql-header__pill {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
}

.ql-header--quizlab .ql-header__pill:hover {
    background: #f8fafc !important;
}

/* 2. Sidebar en modo QuizLab (Light Theme) */
.ql-sidebar.ql-sidebar--quizlab,
.ql-sidebar--quizlab {
    background: #ffffff !important;
    border-right: 1px solid #e2e8f0 !important;
    box-shadow: 2px 0 16px rgba(0, 0, 0, .05) !important;
}

.ql-sidebar--quizlab .ql-sidebar__label {
    color: #94a3b8 !important;
}

.ql-sidebar--quizlab .ql-sidebar__rule {
    background: #e2e8f0 !important;
}

.ql-sidebar--quizlab .ql-sidebar__link {
    color: #475569 !important;
}

.ql-sidebar--quizlab .ql-sidebar__link:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

.ql-sidebar--quizlab .ql-sidebar__link.is-active {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    font-weight: 700 !important;
}

.ql-sidebar--quizlab .ql-sidebar__count {
    background: #f1f5f9 !important;
    color: #475569 !important;
}

.ql-sidebar--quizlab .ql-sidebar__count.is-alert {
    background: var(--ql-danger-strong) !important;
    color: #ffffff !important;
}

.ql-sidebar--quizlab .ql-sidebar__dot {
    border-color: #ffffff !important;
}

/* ==========================================================================
   RESPONSIVE (< 760px)
   ========================================================================== */

@media (max-width: 760px) {
    .ql-sidebar {
        transform: translateX(-100%) !important;
        width: var(--ql-sidebar-width) !important;
    }

    /* Ocultar el botón hamburguesa viejo */
    .triger,
    header .header_inner .left-side .triger {
        display: none !important;
    }

    body.ql-sidebar-open .ql-sidebar {
        transform: translateX(0) !important;
    }

    body.ql-sidebar-open .ql-sidebar-overlay {
        display: block !important;
    }

    /* Reset de márgenes laterales en móvil y preservación del padding superior */
    #wrapper:not(.course-watch),
    #wrapper.horizontal,
    .main_content,
    .page-content,
    #content_wrapper,
    .profile-page-container {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body:has(.ql-header) #wrapper:not(.course-watch),
    body:has(.ql-header) #wrapper.horizontal,
    .ql-header ~ #wrapper:not(.course-watch),
    body:has(.ql-header) .main_content:not(#wrapper *),
    body:has(.ql-header) .page-content:not(#wrapper *),
    body:has(.ql-header) #content_wrapper:not(#wrapper *) {
        padding-top: var(--ql-header-height, 64px) !important;
    }


    header:not(.ql-header),
    .ql-header {
        left: 0 !important;
        width: 100% !important;
        padding: 0 12px !important;
        gap: 8px !important;
    }

    .ql-brand,
    .ql-brand__logo,
    .ql-header__title,
    .ql-header__lead .ql-header__sep {
        display: none !important;
    }

    .ql-header__actions {
        gap: 8px !important;
    }

    .ql-header__pill span {
        display: none;
    }

    .ql-header__pill {
        padding: 8px !important;
        border-radius: 50% !important;
    }

    /* Forzar siempre alineación completa a la izquierda en móvil */
    .ql-sidebar__nav,
    body.ql-nav-collapsed .ql-sidebar__nav {
        align-items: stretch !important;
        padding: 16px 14px 24px !important;
    }

    .ql-sidebar__label,
    body.ql-nav-collapsed .ql-sidebar__label {
        display: block !important;
        text-align: left !important;
    }

    .ql-sidebar__rule,
    body.ql-nav-collapsed .ql-sidebar__rule {
        display: none !important;
    }

    .ql-sidebar__link,
    body.ql-nav-collapsed .ql-sidebar__link {
        justify-content: flex-start !important;
        gap: 13px !important;
        width: 100% !important;
        padding: 9px 12px !important;
        text-align: left !important;
    }

    .ql-sidebar__link.is-active::before,
    body.ql-nav-collapsed .ql-sidebar__link.is-active::before {
        left: -8px !important;
    }

    .ql-sidebar__text,
    body.ql-nav-collapsed .ql-sidebar__text {
        display: inline-block !important;
    }

    .ql-sidebar__count,
    body.ql-nav-collapsed .ql-sidebar__count {
        display: inline-block !important;
    }

    .ql-sidebar__dot,
    body.ql-nav-collapsed .ql-sidebar__dot {
        display: none !important;
    }
}

/* ==========================================================================
   QL GLOBAL MODAL & SEARCH PALETTE COMPONENT
   ========================================================================== */

body.ql-modal-open {
    overflow: hidden !important;
}

.ql-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ql-modal.is-open {
    display: flex;
}

.ql-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(4px);
    border: none;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.ql-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    animation: qlModalFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes qlModalFadeIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ql-modal .ql-modal__header,
.ql-modal .ql-modal__footer,
.ql-modal__header,
.ql-modal__footer {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px;
    padding: 16px 20px;
    box-sizing: border-box !important;
}

.ql-modal .ql-modal__header,
.ql-modal__header {
    border-bottom: 1px solid var(--ql-border, #e2e8f0);
}

.ql-modal .ql-modal__footer,
.ql-modal__footer {
    border-top: 1px solid var(--ql-border, #e2e8f0);
}

.ql-modal__body {
    max-height: calc(100vh - 190px);
    overflow-y: auto;
    padding: 18px 20px;
}

.ql-modal__close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--ql-muted);
    border: none;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.ql-modal__close:hover {
    background: #e2e8f0;
    color: var(--ql-ink);
}

/* Buscador global (Command Palette) */
.ql-search-modal {
    align-items: flex-start;
    padding-top: 10vh;
}

.ql-modal .ql-search-modal__header,
.ql-search-modal__header {
    align-items: center !important;
    padding: 12px 14px 12px 18px !important;
}

.ql-search-modal__field {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 10px;
    color: var(--ql-muted);
    margin: 0;
    cursor: text;
}

.ql-search-modal__field input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: none;
    color: var(--ql-ink);
    font-size: 15px;
    font-family: inherit;
}

.ql-search-modal__field input:focus,
.ql-search-modal__field input:focus-visible {
    outline: 0;
    box-shadow: none;
}

.ql-search-modal__body {
    max-height: min(56vh, 460px);
    padding: 8px 10px 12px;
}

.ql-search-modal__group[hidden],
.ql-search-modal__item[hidden] {
    display: none !important;
}

.ql-search-modal__label {
    margin: 12px 10px 6px;
    color: var(--ql-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.ql-search-modal__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    color: inherit;
    text-decoration: none !important;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.ql-search-modal__item:hover,
.ql-search-modal__item:focus-visible {
    background: #f1f5f9;
    color: var(--ql-primary) !important;
}

.ql-search-modal__item strong {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ql-ink);
    line-height: 1.3;
}

.ql-search-modal__item:hover strong {
    color: var(--ql-primary);
}

.ql-search-modal__item small {
    display: block;
    color: var(--ql-muted);
    font-size: 12px;
    line-height: 1.2;
    margin-top: 2px;
}

.ql-search-modal__icon {
    display: flex;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    height: 36px;
    border-radius: 10px;
    background: #eef1fe;
    color: var(--ql-primary);
    font-size: 18px;
    transition: background 0.15s ease, color 0.15s ease;
}

.ql-search-modal__item:hover .ql-search-modal__icon {
    background: var(--ql-primary);
    color: #ffffff;
}

.ql-search-modal__empty {
    margin: 24px 10px;
    color: var(--ql-muted);
    text-align: center;
    font-size: 13.5px;
}

.ql-search-modal__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    border-top: 1px solid var(--ql-border);
    color: var(--ql-muted);
    font-size: 11.5px;
    background: #fafbfc;
}

.ql-search-modal__footer kbd {
    padding: 2px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #ffffff;
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

@media (max-width: 640px) {
    .ql-search-modal {
        padding: 12px;
        padding-top: 4vh;
    }
    .ql-search-modal__body {
        max-height: 65vh;
    }
}

/* UIkit Modals Z-Index & Header Overlap Fix */
.uk-modal,
[uk-modal] {
    z-index: 100000 !important;
}

.uk-modal.uk-open {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 24px 16px !important;
}

.uk-modal-dialog {
    margin: auto !important;
}

@media (max-width: 640px) {
    .uk-modal.uk-open {
        padding: 16px 10px !important;
        align-items: flex-start !important;
    }
    .uk-modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px auto !important;
        border-radius: 14px !important;
        padding: 16px !important;
    }
}


