﻿:root {
    --nv-indigo: #2c2766;
    --nv-violet: #5800ff;
    --nv-coral: #ff5352;
}

/* 🔹 Notificaciones */
#notification-dropdown {
    width: 300px;
    max-width: 90vw;
    overflow-wrap: break-word;
    white-space: normal;
}

#page-header-notifications-dropdown {
    position: relative;
    font-size: 22px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#notification-count {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 12px;
    min-width: 18px;
    height: 18px;
    padding: 2px 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--nv-coral);
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    display: none;
}

.notification-item.no-leida {
    background: #fff;
    font-weight: bold;
    border-left: 4px solid var(--nv-violet);
    padding: 10px;
    transition: background-color .3s;
}

    .notification-item.no-leida:hover {
        background: #f8f9fa;
    }

.notification-item.leida {
    background: #f0f0f0 !important;
    color: #6c757d !important;
    border-left: 4px solid rgba(44,39,102,.35);
    padding: 10px;
}

.notification-item.no-leida .avatar-title {
    background: var(--nv-violet) !important;
    color: #fff;
}

.notification-item.leida .avatar-title {
    background: rgba(44,39,102,.7) !important;
    color: #fff;
}

/* ========================= BARRA LATERAL ========================= */
.vertical-menu {
    position: fixed;
    top: 70px;
    bottom: 0;
    left: 0;
    width: 250px;
    background-image: linear-gradient(180deg,var(--nv-indigo) 0%,var(--nv-violet) 55%,var(--nv-coral) 100%) !important;
    background-color: transparent !important;
    display: flex;
    flex-direction: column;
    color: #fff !important;
    z-index: 1; /* ✅ Corregido: Devuelto a 1 para evitar superposición con el topbar */
}

    .vertical-menu::before, .vertical-menu::after,
    .vertical-menu .navbar-brand-box, .vertical-menu #sidebar-menu, .vertical-menu .h-100,
    .vertical-menu [data-simplebar], .vertical-menu .menu-wrapper {
        background: transparent !important;
    }

    .vertical-menu .simplebar-mask, .vertical-menu .simplebar-content-wrapper, .vertical-menu .simplebar-offset,
    .vertical-menu .simplebar-content, .vertical-menu .simplebar-track {
        background: transparent !important;
    }

    .vertical-menu .navbar-brand-box {
        border-bottom: none !important;
        box-shadow: none !important;
    }

    .vertical-menu .menu-title {
        color: #fff !important;
        background: transparent !important;
        opacity: .9;
    }

    .vertical-menu #sidebar-menu .menu-title, .vertical-menu #sidebar-menu a {
        color: #fff !important;
    }

    .vertical-menu #sidebar-menu i {
        color: #e9e9ff !important;
    }

    .vertical-menu #sidebar-menu .has-arrow:after {
        border-color: #fff transparent transparent !important;
        transition: transform .2s ease;
        opacity: .9;
    }

    .vertical-menu #sidebar-menu a:hover, .vertical-menu #sidebar-menu a:focus {
        background: rgba(88,0,255,.18) !important;
        color: #fff !important;
    }

    .vertical-menu #sidebar-menu li.mm-active > a,
    .vertical-menu #sidebar-menu a.has-arrow[aria-expanded="true"] {
        background: rgba(88,0,255,.28) !important;
        color: #fff !important;
        box-shadow: inset 4px 0 0 var(--nv-coral);
    }

    .vertical-menu #sidebar-menu .has-arrow[aria-expanded="true"]:after {
        transform: rotate(180deg);
    }

    .vertical-menu #sidebar-menu .sub-menu {
        background: transparent !important;
    }

        .vertical-menu #sidebar-menu .sub-menu li a {
            color: #f3f3f3 !important;
            padding-left: 50px;
            border-left: 3px solid transparent;
        }

            .vertical-menu #sidebar-menu .sub-menu li a:hover,
            .vertical-menu #sidebar-menu .sub-menu li a.active {
                background: rgba(88,0,255,.18) !important;
                color: #fff !important;
                border-left-color: var(--nv-coral);
            }

    .vertical-menu #sidebar-menu .menu-item.active {
        background: rgba(88,0,255,.28) !important;
        border-left: 4px solid var(--nv-coral) !important;
        color: #fff !important;
    }

    .vertical-menu .footer-social {
        background: transparent !important;
        border-top: 0 !important;
        color: #fff !important;
        text-align: center;
        padding: 15px 10px;
    }

        .vertical-menu .footer-social a {
            color: #fff !important;
            text-decoration: none;
            opacity: .9;
        }

            .vertical-menu .footer-social a:hover {
                opacity: 1;
            }

        .vertical-menu .footer-social .social-icons img {
            filter: brightness(0) invert(1);
            opacity: .95;
            transition: .15s;
        }

        .vertical-menu .footer-social .social-icons a:hover img {
            opacity: 1;
            transform: scale(1.05);
        }

.menu-wrapper {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px;
}

/* ====== Topbar ====== */
#page-topbar, #page-topbar .navbar-header {
    height: 70px;
    border-bottom: none !important;
    box-shadow: none !important;
}

#page-topbar {
    background-image: linear-gradient(90deg,var(--nv-indigo) 0 250px,#f3f6f8 250px 100%) !important;
    transition: background-image .2s ease;
    position: relative;
    z-index: 1030;
}

    #page-topbar .navbar-brand-box {
        width: 250px;
        height: 70px;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 !important;
        transition: width .2s ease, height .2s ease;
    }

        #page-topbar .navbar-brand-box .logo-sm {
            display: none !important;
        }

        #page-topbar .navbar-brand-box .logo-lg {
            display: inline-block !important;
        }

            #page-topbar .navbar-brand-box .logo-lg img {
                height: 40px !important;
                width: auto !important;
            }

        #page-topbar .navbar-brand-box .logo-sm img {
            height: 22px !important;
            width: auto !important;
        }

        #page-topbar .navbar-brand-box a.logo {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
        }

/* ====== Estado colapsado ====== */
body.vertical-collpsed #page-topbar {
    background-image: linear-gradient(90deg,var(--nv-indigo) 0 70px,#f3f6f8 70px 100%) !important;
}

    body.vertical-collpsed #page-topbar .navbar-brand-box {
        width: 70px !important;
    }

        body.vertical-collpsed #page-topbar .navbar-brand-box .logo-sm {
            display: inline-block !important;
        }

        body.vertical-collpsed #page-topbar .navbar-brand-box .logo-lg {
            display: none !important;
        }

        body.vertical-collpsed #page-topbar .navbar-brand-box img {
            height: 22px !important;
            width: auto !important;
        }

.vertical-menu, .vertical-menu * {
    box-shadow: none !important;
}

    /* ===== Fly-out en colapsado ===== */
    .vertical-menu,
    .vertical-menu .simplebar-content-wrapper,
    .vertical-menu .simplebar-content,
    .vertical-menu .h-100 {
        overflow: visible !important;
    }

body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li {
    position: relative;
}

    body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > a {
        background: transparent !important;
    }

    body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu {
        position: absolute !important;
        left: 72px;
        top: 50%;
        transform: translateY(-50%);
        display: none;
        min-width: 260px;
        background: #fff !important;
        color: #2a2a2a !important;
        border-radius: 12px;
        padding: 14px 16px;
        box-shadow: 0 14px 30px rgba(31,34,38,0.16);
        border: 1px solid rgba(0,0,0,.06);
        white-space: nowrap;
        z-index: 2000;
    }

    body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu {
        display: none !important;
    }

    body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li:hover > ul.sub-menu {
        display: block !important;
    }


.vertical-menu #sidebar-menu .sub-menu .flyout-title {
    display: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    height: 0 !important;
}

body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu li.flyout-title {
    display: block !important;
    padding: 12px 20px 10px 20px !important;
    margin: 0 0 12px 0 !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: #6c757d;
    border-bottom: 1px solid rgba(0,0,0,.06);
}

    body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu li.flyout-title + li {
        margin-top: 6px !important;
    }

        body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu li.flyout-title + li > a {
            padding-top: 18px !important;
        }

body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu li a {
    color: #2a2a2a !important;
    font-weight: 500;
    padding: 12px 20px;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 12px;
}

    body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu li a i {
        color: #6c6f73 !important;
    }

    body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu li a:hover,
    body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu li a.active {
        background: #f6f7f9 !important;
        color: #111 !important;
        border-left-color: var(--nv-coral);
    }

body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: #fff;
    border-left: 1px solid rgba(0,0,0,.06);
    border-top: 1px solid rgba(0,0,0,.06);
    box-shadow: -2px -2px 6px rgba(31,34,38,0.06);
}

body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > a:hover {
    background: transparent !important;
}

/* Tooltips para ítems sin submenú cuando está colapsado */
body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > a:not(.has-arrow)::after {
    content: attr(data-label);
    position: absolute;
    left: 72px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    color: #333;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,.06);
    box-shadow: 0 8px 20px rgba(0,0,0,.15);
    white-space: nowrap;
    display: none;
    font-weight: 500;
    z-index: 2000;
}

body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > a:not(.has-arrow)::before {
    content: "";
    position: absolute;
    left: 64px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: #fff;
    box-shadow: -1px 1px 0 rgba(0,0,0,.08);
    display: none;
    z-index: 2001;
}

body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > a:not(.has-arrow):hover::after,
body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > a:not(.has-arrow):hover::before {
    display: block;
}

/* ===== Modo sin sesión ===== */
body.no-auth .vertical-menu {
    display: none !important;
}

body.no-auth #page-topbar {
    background: #f3f6f8 !important;
    background-image: none !important;
}

@media (min-width: 992px) {
    body.no-auth main[role="main"] {
        margin-left: 0 !important;
    }
}

body.no-auth #session-timer, body.no-auth .footer-social {
    display: none !important;
}

/* Logo adaptativo */
.app-logo {
    display: block;
}

/* Ocultar completamente el logo del topbar cuando no hay sesión */
body.no-auth #page-topbar .navbar-brand-box .logo {
    display: none !important;
}

body.no-auth #page-topbar .navbar-brand-box {
    width: 0 !important;
    padding: 0 !important;
}


/* 🔒 Estilo genérico para elementos deshabilitados por falta de empresa */
.ui-disabled {
    pointer-events: none !important;
    opacity: .5 !important;
}

/* Logo Novandi en el footer lateral */
.vertical-menu .footer-social .brand-wrapper img.brand-logo {
    height: 32px;
    width: auto;
    filter: none !important;
    opacity: 1 !important;
}

.dropdown-menu-right {
    right: 0;
    left: auto;
}

.dropdown-menu.show {
    display: block;
}

#page-topbar .navbar-header > .d-flex.ms-auto {
    min-width: 0;
}

#page-topbar .header-user-btn {
    max-width: clamp(180px, 55vw, 420px);
    min-width: 0;
}

#page-topbar .header-user-info {
    min-width: 0;
}

    #page-topbar .header-user-info .user-name,
    #page-topbar .header-user-info .user-company {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

@media (max-width:576px) {
    #page-topbar .header-user-info .user-company {
        display: none;
    }

    #page-topbar .header-profile-user {
        width: 40px;
        height: 40px;
    }

    #page-topbar .header-user-btn {
        max-width: 50vw;
    }
}


/* ========================================================
   SISTEMA 100% RESPONSIVO PARA EL MENÚ Y CONTENIDO PRINCIPAL
   ======================================================== */

/* Cortina oscura (solo visible en móviles cuando el menú está abierto) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 60px);
    background: rgba(0, 0, 0, 0.5);
    z-index: 1028;
    transition: opacity 0.3s ease;
}

/* 2. COMPORTAMIENTO EN MÓVILES Y TABLETS (Menores a 992px) */
@media (max-width: 991.98px) {
    #page-topbar, #page-topbar .navbar-header {
        height: 60px;
        border-bottom: 0 !important;
        box-shadow: none !important;
    }

    #page-topbar {
        background-image: linear-gradient(90deg,var(--nv-indigo) 0 150px,#f3f6f8 150px 100%) !important;
    }

        #page-topbar .navbar-brand-box {
            width: 150px !important;
            height: 60px !important;
        }

            #page-topbar .navbar-brand-box .logo-lg img {
                height: 26px !important;
            }

            #page-topbar .navbar-brand-box .logo-sm img {
                height: 20px !important;
            }

    body.vertical-collpsed #page-topbar {
        background-image: linear-gradient(90deg,var(--nv-indigo) 0 60px,#f3f6f8 60px 100%) !important;
    }

        body.vertical-collpsed #page-topbar .navbar-brand-box {
            width: 60px !important;
            height: 60px !important;
        }

    #page-topbar::before, #page-topbar::after {
        content: none !important;
        display: none !important;
    }

    /* El menú se oculta a la izquierda por defecto */
    .vertical-menu {
        position: fixed !important;
        left: -250px;
        width: 250px !important;
        height: calc(100vh - 60px) !important;
        top: 60px !important;
        /* ✅ Corregido: margen negativo eliminado */
        z-index: 1029 !important;
        transition: left 0.3s ease !important;
    }

        .vertical-menu #sidebar-menu > ul {
            margin-top: 0 !important;
            padding-top: 6px;
        }

    /* Cuando JS le agrega la clase 'sidebar-enable', el menú entra */
    body.sidebar-enable .vertical-menu {
        left: 0 !important;
    }

    /* Muestra la cortina oscura al abrir el menú */
    body.sidebar-enable .sidebar-backdrop {
        display: block;
    }

    /* El contenido ocupa el 100% */
    main[role="main"], .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Desactivar fly-out en pantallas chicas */
    body.vertical-collpsed .vertical-menu #sidebar-menu > ul > li > ul.sub-menu {
        position: static !important;
        left: auto;
        top: auto;
        transform: none;
        min-width: 100%;
        box-shadow: none;
        border-radius: 8px;
        z-index: auto;
    }
}

/* 3. COMPORTAMIENTO EN ESCRITORIO (Mayores a 992px) */
@media (min-width: 992px) {
    .vertical-menu {
        left: 0;
        width: 250px;
        transition: width 0.3s ease;
        top: 70px;
        
    }

    /* Modo colapsado (botón hamburguesa en PC) */
    body.vertical-collpsed .vertical-menu {
        width: 70px !important;
        position: fixed !important;
        bottom: 0 !important;
        z-index: 1001 !important;
        top: 70px !important;
    }

  
}
