/*
 * Sidebar moderno EEMPB
 * Capa visual aislada sobre KaiAdmin. No modifica los archivos del vendor.
 */

:root {
    --eem-sidebar-blue: #0f5d8f;
    --eem-sidebar-blue-deep: #0b2f57;
    --eem-sidebar-blue-soft: #0b4772;
    --eem-sidebar-orange: #f58a1f;
    --eem-sidebar-orange-light: #ffc06f;
    --eem-sidebar-text: #f9fcff;
    --eem-sidebar-muted: rgba(241, 248, 255, 0.86);
    --eem-sidebar-border: rgba(255, 255, 255, 0.18);
    --eem-sidebar-surface: rgba(255, 255, 255, 0.15);
    --eem-sidebar-surface-active: rgba(255, 255, 255, 0.21);
    --eem-sidebar-shadow: 14px 0 36px rgba(11, 47, 87, 0.22);
}

.sidebar.sidebar-modern {
    isolation: isolate;
    overflow: hidden;
    color: var(--eem-sidebar-text);
    background-color: var(--eem-sidebar-blue-deep) !important;
    background-image:
        radial-gradient(circle at 8% 0%, rgba(255, 255, 255, 0.16), transparent 28%),
        radial-gradient(circle at 96% 12%, rgba(245, 138, 31, 0.12), transparent 27%),
        linear-gradient(180deg, #0f5d8f 0%, #0b4772 52%, #0b2f57 100%) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    box-shadow: var(--eem-sidebar-shadow);
}

.sidebar.sidebar-modern::before,
.sidebar.sidebar-modern::after {
    position: absolute;
    z-index: -1;
    border-radius: 999px;
    content: "";
    pointer-events: none;
}

.sidebar.sidebar-modern::before {
    top: 76px;
    right: -92px;
    width: 210px;
    height: 210px;
    background: rgba(245, 138, 31, 0.14);
    filter: blur(8px);
}

.sidebar.sidebar-modern::after {
    bottom: 8%;
    left: -105px;
    width: 230px;
    height: 230px;
    background: rgba(255, 255, 255, 0.10);
    filter: blur(12px);
}

.sidebar-modern .sidebar-logo,
.sidebar-modern .logo-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04)) !important;
    border-bottom: 1px solid var(--eem-sidebar-border);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    backdrop-filter: blur(14px) saturate(120%);
}

.sidebar-modern .logo-header {
    padding-inline: 18px;
}

.sidebar-modern .logo {
    min-width: 0;
}

.sidebar-modern .navbar-brand {
    width: auto;
    max-width: 156px;
    height: 54px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(5, 36, 67, 0.18));
    transition: transform 0.25s ease, filter 0.25s ease;
}

.sidebar-modern .logo:hover .navbar-brand {
    transform: translateY(-1px);
    filter: drop-shadow(0 6px 13px rgba(5, 36, 67, 0.24));
}

.sidebar-modern .btn-toggle {
    width: 34px;
    height: 34px;
    padding: 0;
    place-items: center;
    color: #fff !important;
    border: 1px solid var(--eem-sidebar-border);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.14) !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sidebar-modern .btn-toggle:hover,
.sidebar-modern .btn-toggle:focus-visible {
    color: #fff !important;
    border-color: rgba(223, 113, 16, 0.68);
    background: rgba(245, 138, 31, 0.88) !important;
    transform: translateY(-1px);
}

.sidebar-modern .sidebar-wrapper {
    position: relative;
    z-index: 2;
    background: transparent;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.32) transparent;
}

.sidebar-modern .sidebar-wrapper::-webkit-scrollbar {
    width: 6px;
}

.sidebar-modern .sidebar-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-modern .sidebar-wrapper::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
}

.sidebar-modern .sidebar-content {
    position: relative;
    z-index: 2;
    min-height: 100%;
    padding: 14px 10px 24px;
}

.sidebar-modern .sidebar-footer-illustration {
    position: absolute;
    z-index: 1;
    top: 70px;
    right: 0;
    bottom: 0;
    left: 0;
    background-image: var(--eem-sidebar-footer-image);
    background-position: 30% bottom;
    background-repeat: no-repeat;
    background-size: auto 78%;
    filter: none;
    opacity: 0.46;
    pointer-events: none;
}

.sidebar-search {
    position: relative;
    margin: 4px 4px 14px;
}

.sidebar-search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    border: 0;
    clip: rect(0, 0, 0, 0);
}

.sidebar-search-control {
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-search-icon {
    position: absolute;
    left: 13px;
    z-index: 1;
    color: rgba(255, 255, 255, 0.68);
    font-size: 12px;
    pointer-events: none;
}

.sidebar-search-input {
    width: 100%;
    height: 42px;
    padding: 0 40px 0 38px;
    color: #fff;
    border: 1px solid var(--eem-sidebar-border);
    border-radius: 14px;
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    -webkit-backdrop-filter: blur(12px) saturate(125%);
    backdrop-filter: blur(12px) saturate(125%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 5px 16px rgba(8, 42, 76, 0.10);
    font-size: 12px;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-search-input::placeholder {
    color: rgba(235, 243, 252, 0.62);
}

.sidebar-search-input:hover {
    background: rgba(255, 255, 255, 0.13);
}

.sidebar-search-input:focus {
    border-color: rgba(223, 113, 16, 0.82);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(245, 138, 31, 0.20);
}

.sidebar-search-clear {
    position: absolute;
    right: 7px;
    display: inline-grid;
    width: 29px;
    height: 29px;
    padding: 0;
    place-items: center;
    color: rgba(255, 255, 255, 0.76);
    border: 0;
    border-radius: 9px;
    background: transparent;
}

.sidebar-search-clear:hover,
.sidebar-search-clear:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.13);
}

.sidebar-search-empty {
    margin: 10px 4px 0;
    color: rgba(255, 255, 255, 0.70);
    font-size: 11px;
    line-height: 1.45;
    text-align: center;
}

.sidebar-modern .nav-secondary > .nav-section {
    margin: 20px 9px 7px;
    padding: 0;
}

.sidebar-modern .nav-secondary > .nav-section:first-of-type {
    margin-top: 8px;
}

.sidebar-modern .nav-section .text-section {
    display: inline-flex;
    width: auto;
    padding: 4px 8px;
    color: rgba(244, 250, 255, 0.92) !important;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    backdrop-filter: blur(12px) saturate(120%);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.105em;
    line-height: 1.35;
    text-shadow: 0 1px 2px rgba(5, 36, 67, 0.30);
    text-transform: uppercase;
}

.sidebar-modern .nav-item {
    margin: 3px 0;
}

.sidebar-modern .nav-item > a {
    min-height: 45px;
    margin: 0;
    padding: 10px 12px;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.10) !important;
    -webkit-backdrop-filter: blur(12px) saturate(125%);
    backdrop-filter: blur(12px) saturate(125%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 14px rgba(8, 42, 76, 0.08);
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sidebar-modern .nav-item > a:hover,
.sidebar-modern .nav-item > a:focus-visible {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.24);
    background: var(--eem-sidebar-surface) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 7px 18px rgba(8, 42, 76, 0.10);
    transform: translateX(2px);
}

.sidebar-modern .nav-item > a > i {
    width: 25px;
    color: rgba(255, 255, 255, 0.90) !important;
    font-size: 15px;
    text-align: center;
    transition: color 0.2s ease, transform 0.2s ease;
}

.sidebar-modern .nav-item > a:hover > i,
.sidebar-modern .nav-item > a:focus-visible > i {
    color: var(--eem-sidebar-orange-light) !important;
    transform: scale(1.06);
}

.sidebar-modern .nav-item > a p {
    overflow: hidden;
    color: #fff !important;
    font-size: 12.5px;
    font-weight: 750;
    line-height: 1.35;
    text-shadow: 0 1px 2px rgba(5, 36, 67, 0.34);
    text-overflow: ellipsis;
}

.sidebar-modern .nav-item.active > a:not([data-bs-toggle="collapse"]) {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.20);
    background:
        linear-gradient(135deg, rgba(245, 138, 31, 0.98), rgba(223, 113, 16, 0.94)) !important;
    box-shadow: 0 9px 20px rgba(223, 113, 16, 0.22);
}

.sidebar-modern .nav-item.active > a[data-bs-toggle="collapse"] {
    color: #fff !important;
    border-color: rgba(245, 138, 31, 0.52);
    background: rgba(255, 255, 255, 0.14) !important;
    box-shadow:
        inset 3px 0 0 rgba(245, 138, 31, 0.92),
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 7px 18px rgba(11, 47, 87, 0.12);
}

.sidebar-modern .nav-item.active > a:not([data-bs-toggle="collapse"]) > i {
    color: #fff !important;
}

.sidebar-modern .nav-item.active > a[data-bs-toggle="collapse"] > i,
.sidebar-modern .nav-item.active > a[data-bs-toggle="collapse"] > .caret {
    color: var(--eem-sidebar-orange-light) !important;
}

/* KaiAdmin dibuja una barra azul en el lado izquierdo del elemento activo. */
.sidebar-modern .nav-item.active > a::before,
.sidebar-modern .nav-item.submenu.active > a::before {
    display: none !important;
    content: none !important;
}

.sidebar-modern .nav-item .caret {
    color: rgba(255, 255, 255, 0.67);
    transition: transform 0.22s ease;
}

.sidebar-modern .nav-item > a[aria-expanded="true"] .caret {
    transform: rotate(180deg);
}

.sidebar-modern .btn-toggle:focus-visible,
.sidebar-modern .sidebar-search-clear:focus-visible,
.sidebar-modern .nav-item > a:focus-visible,
.sidebar-modern .nav-collapse > li > a:focus-visible {
    outline: 2px solid rgba(255, 192, 111, 0.95);
    outline-offset: 2px;
}

.sidebar-modern .nav-collapse {
    position: relative;
    margin: 4px 0 8px 17px;
    padding: 4px 0 4px 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.sidebar-modern .nav-collapse::before {
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 0;
    width: 2px;
    border-radius: 999px;
    content: "";
    background: linear-gradient(180deg, rgba(245, 138, 31, 0.95), rgba(223, 113, 16, 0.82));
}

.sidebar-modern .nav-collapse > li {
    margin: 2px 0;
}

.sidebar-modern .nav-collapse > li > a {
    min-height: 35px;
    padding: 8px 10px;
    color: #fff !important;
    border: 0;
    border-radius: 10px;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    text-shadow: 0 1px 2px rgba(5, 36, 67, 0.34);
    transition: color 0.18s ease, padding-left 0.18s ease, opacity 0.18s ease;
}

.sidebar-modern .nav-collapse > li:not(.active) > a {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.sidebar-modern .nav-collapse .sub-item {
    color: #fff !important;
    font-weight: 650;
}

.sidebar-modern .nav-collapse > li > a:hover,
.sidebar-modern .nav-collapse > li > a:focus-visible {
    padding-left: 13px;
    color: #fff !important;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.sidebar-modern .nav-collapse > li.active > a {
    color: #fff !important;
    border: 0;
    background:
        linear-gradient(135deg, rgba(245, 138, 31, 0.98), rgba(223, 113, 16, 0.94));
    box-shadow: 0 8px 18px rgba(223, 113, 16, 0.20);
}

.sidebar-modern .nav-collapse .sub-item {
    font-size: 12px;
    line-height: 1.35;
}

.sidebar-modern .sidebar-nav-final-item {
    margin-top: 16px;
    margin-bottom: 12px;
}

.sidebar-modern [hidden] {
    display: none !important;
}

.sidebar-modern-backdrop {
    position: fixed;
    z-index: 999;
    inset: 0;
    visibility: hidden;
    background: rgba(3, 22, 48, 0.56);
    opacity: 0;
    backdrop-filter: blur(2px);
    transition: visibility 0.22s ease, opacity 0.22s ease;
}

html.nav_open .sidebar-modern-backdrop {
    visibility: visible;
    opacity: 1;
}

@media screen and (min-width: 992px) {
    .sidebar-modern-backdrop {
        display: none;
    }

    .sidebar-modern .nav-toggle .sidenav-toggler {
        display: none;
    }

    .sidebar-modern .nav-toggle .toggle-sidebar {
        display: inline-grid;
    }

    .sidebar_minimize .sidebar-modern .sidebar-search,
    .sidebar_minimize_hover .sidebar-modern .sidebar-search {
        display: none;
    }

    .sidebar_minimize:not(.sidebar_minimize_hover) .sidebar-modern .sidebar-footer-illustration {
        opacity: 0;
    }

    .sidebar_minimize .sidebar-modern .nav-section .text-section {
        opacity: 0;
    }

    .sidebar_minimize:not(.sidebar_minimize_hover) .sidebar-modern .nav.nav-secondary > .nav-item {
        display: flex !important;
        width: 100%;
        justify-content: center;
    }

    .sidebar_minimize:not(.sidebar_minimize_hover) .sidebar-modern .nav-item > a {
        display: flex !important;
        width: 52px;
        min-width: 52px;
        min-height: 45px;
        margin: 3px auto !important;
        padding: 0 !important;
        align-items: center;
        justify-content: center;
    }

    .sidebar_minimize:not(.sidebar_minimize_hover) .sidebar-modern .nav-item > a > i {
        width: 20px !important;
        min-width: 20px;
        margin: 0 !important;
        flex: 0 0 20px;
        text-align: center;
    }

    .sidebar_minimize:not(.sidebar_minimize_hover) .sidebar-modern .nav-item > a > p,
    .sidebar_minimize:not(.sidebar_minimize_hover) .sidebar-modern .nav-item > a > .caret {
        display: none !important;
    }
}

@media screen and (max-width: 991.98px) {
    .sidebar.sidebar-modern {
        box-shadow: 18px 0 42px rgba(8, 42, 76, 0.28);
    }

    .sidebar-modern .nav-toggle .toggle-sidebar {
        display: none;
    }

    .sidebar-modern .nav-toggle .sidenav-toggler {
        display: inline-grid;
    }

    .sidebar-modern .sidebar-content {
        padding-bottom: max(28px, env(safe-area-inset-bottom));
    }

    .sidebar-modern .sidebar-footer-illustration {
        background-position: 28% bottom;
        background-size: auto 74%;
        opacity: 0.44;
    }

    .sidebar-modern .sidebar-search-input {
        height: 44px;
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-modern *,
    .sidebar-modern *::before,
    .sidebar-modern *::after,
    .sidebar-modern-backdrop {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
