/* ========================================================
   Estilos para Menú Dinámico - TreeView DevExpress Blazor
   ======================================================== */

/* Contenedor principal del sidebar */
#sidebar,
.sidebar-treeview {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 100vh !important;
    padding: 0 !important;
    background: linear-gradient(180deg, #667eea 0%, #5a72d4 50%, #4e66c4 100%) !important;
    color: white !important;
}

/* ============================
   SECCIÓN DE PERFIL DE USUARIO
   ============================ */
.user-profile-section {
    padding: 15px 12px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    background: rgba(0, 0, 0, 0.1) !important;
}

.user-profile-link {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    color: white !important;
    text-decoration: none !important;
    padding: 10px 14px !important;
    border-radius: 6px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    transition: all 0.2s ease !important;
    border-left: 3px solid #3498db !important;
}

.user-profile-link:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    color: white !important;
}

.user-profile-link i {
    font-size: 20px !important;
}

.user-profile-link span {
    font-weight: 500 !important;
    font-size: 13px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* ============================
   INDICADOR DE CARGA
   ============================ */
.menu-loading {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    padding: 30px 20px !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-style: italic !important;
    font-size: 14px !important;
}

.menu-loading i {
    font-size: 20px !important;
}

/* ============================
   TREEVIEW PRINCIPAL
   ============================ */
.menu-treeview {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 10px 12px !important;
    background: transparent !important;
}

/* Componente TreeView de DevExpress */
.menu-treeview.dxbl-treeview,
#sidebar .dxbl-treeview {
    background: transparent !important;
    color: white !important;
}

/* ============================
   PANEL DE FILTRO/BÚSQUEDA
   ============================ */
.menu-treeview .dxbl-filter-editor,
.menu-treeview .dxbl-treeview-filter,
#sidebar .dxbl-filter-editor,
#sidebar [class*="filter"] {
    background: rgba(0, 0, 0, 0.15) !important;
    border-radius: 8px !important;
    margin-bottom: 15px !important;
    padding: 6px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Input de búsqueda */
.menu-treeview input[type="text"],
.menu-treeview .dxbl-text-edit input,
.menu-treeview .dxbl-input,
#sidebar input[type="text"],
#sidebar .dxbl-text-edit input {
    background: rgba(255, 255, 255, 0.95) !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 10px 35px 10px 12px !important;
    color: #2c3e50 !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    width: 100% !important;
    transition: all 0.2s ease !important;
}

.menu-treeview input[type="text"]::placeholder,
#sidebar input[type="text"]::placeholder {
    color: #95a5a6 !important;
    font-size: 12px !important;
}

.menu-treeview input[type="text"]:focus,
#sidebar input[type="text"]:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3) !important;
}

/* Icono de búsqueda */
.menu-treeview .dxbl-text-edit svg,
.menu-treeview .dxbl-image,
#sidebar .dxbl-text-edit svg {
    color: #7f8c8d !important;
}

/* ============================
   ESTRUCTURA DEL TREEVIEW
   ============================ */

/* Contenedor de todos los nodos */
.menu-treeview ul,
#sidebar .dxbl-treeview ul,
#sidebar ul[class*="treeview"] {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Cada item/nodo del árbol */
.menu-treeview li,
#sidebar .dxbl-treeview li,
#sidebar .dxbl-treeview-item,
#sidebar .dxbl-treeview-node {
    margin-bottom: 3px !important;
    color: white !important;
}

/* Contenido de cada nodo */
.menu-treeview .dxbl-treeview-item-container,
.menu-treeview .dxbl-treeview-item-content,
#sidebar .dxbl-treeview-item-container,
#sidebar .dxbl-treeview-item-content {
    display: flex !important;
    align-items: center !important;
    padding: 11px 14px !important;
    border-radius: 8px !important;
    color: rgba(255, 255, 255, 0.95) !important;
    transition: all 0.25s ease !important;
    cursor: pointer !important;
    background: transparent !important;
}

/* Hover en nodos */
.menu-treeview .dxbl-treeview-item-content:hover,
#sidebar .dxbl-treeview-item-content:hover,
#sidebar .dxbl-treeview-item-container:hover {
    background: rgba(52, 152, 219, 0.35) !important;
    color: white !important;
}

/* ============================
   MÓDULOS (CABECERAS)
   ============================ */
.menu-module-header {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border-radius: 6px !important;
    border-left: 3px solid #3498db !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin: 8px 0 4px 0 !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
}

.menu-module-header:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.menu-module-header i {
    font-size: 14px !important;
    width: 18px !important;
    text-align: center !important;
    opacity: 0.9 !important;
}

/* ============================
   ITEMS DE MENÚ (HIJOS)
   ============================ */
.menu-item-link,
.menu-item-text {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 9px 12px !important;
    color: rgba(255, 255, 255, 0.85) !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
    margin: 2px 0 !important;
}

.menu-item-link:hover,
.menu-item-text:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.menu-item-link i,
.menu-item-text i {
    font-size: 13px !important;
    width: 18px !important;
    text-align: center !important;
    opacity: 0.7 !important;
}

.menu-item-link:hover i,
.menu-item-text:hover i {
    opacity: 1 !important;
}

/* ============================
   NODOS HIJOS (SUBITEMS)
   ============================ */

/* Contenedor de hijos */
.menu-treeview li > ul,
.menu-treeview .dxbl-treeview-items,
#sidebar li > ul,
#sidebar .dxbl-treeview-items,
#sidebar .dxbl-treeview-node-children {
    padding-left: 8px !important;
    margin-left: 12px !important;
    border-left: 2px solid rgba(255, 255, 255, 0.15) !important;
    margin-bottom: 12px !important;
    margin-top: 4px !important;
    padding-top: 4px !important;
}

/* Items hijos */
.menu-treeview li > ul li,
.menu-treeview .dxbl-treeview-items > li,
.menu-treeview .dxbl-treeview-items .dxbl-treeview-item,
#sidebar .dxbl-treeview-items .dxbl-treeview-item {
    margin-bottom: 2px !important;
}

.menu-treeview li > ul .dxbl-treeview-item-content,
.menu-treeview .dxbl-treeview-items .dxbl-treeview-item-content,
#sidebar .dxbl-treeview-items .dxbl-treeview-item-content {
    padding: 10px 14px !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-radius: 6px !important;
    margin-left: 0 !important;
    transition: all 0.2s ease !important;
}

.menu-treeview li > ul .dxbl-treeview-item-content:hover,
.menu-treeview .dxbl-treeview-items .dxbl-treeview-item-content:hover,
#sidebar .dxbl-treeview-items .dxbl-treeview-item-content:hover {
    background: rgba(52, 152, 219, 0.25) !important;
    padding-left: 18px !important;
    border-left: 3px solid #3498db !important;
    margin-left: -3px !important;
}

/* ============================
   ICONOS
   ============================ */
.menu-treeview .dxbl-treeview-item-content i,
#sidebar .dxbl-treeview-item-content i,
.treeview-node-link i,
.treeview-node-text i {
    color: white !important;
    margin-right: 12px !important;
    font-size: 15px !important;
    width: 20px !important;
    text-align: center !important;
    opacity: 0.9 !important;
}

/* Iconos en nodos padre */
.menu-treeview li:has(> ul) .dxbl-treeview-item-content i,
#sidebar li:has(> ul) .dxbl-treeview-item-content i {
    opacity: 1 !important;
}

/* Botón de expandir/colapsar */
.menu-treeview .dxbl-treeview-toggle,
.menu-treeview .dxbl-treeview-item-toggle,
#sidebar .dxbl-treeview-toggle,
#sidebar .dxbl-treeview-item-toggle,
#sidebar [class*="toggle-btn"],
#sidebar button[class*="toggle"] {
    color: rgba(255, 255, 255, 0.9) !important;
    background: transparent !important;
    border: none !important;
    padding: 4px !important;
    margin-right: 8px !important;
    cursor: pointer !important;
    transition: transform 0.2s ease !important;
}

.menu-treeview .dxbl-treeview-toggle:hover,
#sidebar .dxbl-treeview-toggle:hover {
    color: white !important;
}

/* ============================
   LINKS DE NAVEGACIÓN
   ============================ */
.treeview-node-link {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    color: inherit !important;
    text-decoration: none !important;
    width: 100% !important;
    padding: 0 !important;
}

.treeview-node-link:hover {
    color: white !important;
    text-decoration: none !important;
}

/* Texto sin link */
.treeview-node-text {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
}

/* ============================
   ESTADO SELECCIONADO
   ============================ */
.menu-treeview .dxbl-selected .dxbl-treeview-item-content,
.menu-treeview .dxbl-active .dxbl-treeview-item-content,
#sidebar .dxbl-selected .dxbl-treeview-item-content,
#sidebar [class*="selected"] .dxbl-treeview-item-content {
    background: rgba(52, 152, 219, 0.5) !important;
    color: white !important;
    font-weight: 600 !important;
}

/* ============================
   FOOTER DEL MENÚ
   ============================ */
.menu-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding: 12px !important;
    margin-top: auto !important;
    background: rgba(0, 0, 0, 0.1) !important;
}

.menu-footer-link {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none !important;
    padding: 10px 12px !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    margin-bottom: 8px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    font-weight: 400 !important;
    font-size: 13px !important;
}

.menu-footer-link:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
}

.menu-footer-link i {
    font-size: 14px !important;
    width: 18px !important;
    text-align: center !important;
}

/* ============================
   BOTÓN DE CERRAR SESIÓN
   ============================ */
.logout-form-menu {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.menu-logout-button {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 12px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    transition: all 0.2s ease !important;
    text-align: left !important;
    border-left: 3px solid #e74c3c !important;
}

.menu-logout-button:hover {
    background: rgba(231, 76, 60, 0.25) !important;
    color: white !important;
}

.menu-logout-button i {
    font-size: 14px !important;
}

/* ============================
   SCROLLBAR PERSONALIZADO
   ============================ */
.menu-treeview::-webkit-scrollbar {
    width: 8px !important;
}

.menu-treeview::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15) !important;
    border-radius: 4px !important;
}

.menu-treeview::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25) !important;
    border-radius: 4px !important;
}

.menu-treeview::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4) !important;
}

/* ============================
   ANIMACIONES
   ============================ */
.menu-treeview .dxbl-treeview-items,
#sidebar .dxbl-treeview-items {
    animation: slideDown 0.25s ease-out !important;
}

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

/* ============================
   MENSAJE DE NO RESULTADOS
   ============================ */
.menu-treeview .dxbl-treeview-empty,
#sidebar [class*="empty"] {
    color: rgba(255, 255, 255, 0.6) !important;
    text-align: center !important;
    padding: 25px 15px !important;
    font-style: italic !important;
    font-size: 13px !important;
}

/* ============================
   BARRA DE NAVEGACIÓN SUPERIOR
   ============================ */
.nav-buttons-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
    padding: 10px 20px !important;
    min-height: auto !important;
    height: 64px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 14px !important;
}

.nav-buttons-container .menu-button,
.nav-buttons-container .menu-button-nav {
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    border-radius: 10px !important;
    padding: 10px 18px !important;
    color: white !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(5px) !important;
    height: auto !important;
    min-height: 40px !important;
}

.nav-buttons-container .menu-button:hover,
.nav-buttons-container .menu-button-nav:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.22) !important;
}

/* Secciones de navegación */
.nav-left-section,
.nav-right-section {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.nav-center-section {
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.menubutton-float-end {
    margin-left: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

/* Título de la app */
.app-title {
    color: white !important;
    font-size: 1.3rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.app-title i {
    font-size: 1.5rem !important;
}

/* Botones especiales */
.user-button {
    background: rgba(46, 204, 113, 0.25) !important;
    border-color: rgba(46, 204, 113, 0.45) !important;
}

.user-button:hover {
    background: rgba(46, 204, 113, 0.4) !important;
}

.logout-button {
    background: rgba(231, 76, 60, 0.25) !important;
    border-color: rgba(231, 76, 60, 0.45) !important;
}

.logout-button:hover {
    background: rgba(231, 76, 60, 0.4) !important;
}

.login-button {
    background: rgba(52, 152, 219, 0.25) !important;
    border-color: rgba(52, 152, 219, 0.45) !important;
}

.login-button:hover {
    background: rgba(52, 152, 219, 0.4) !important;
}

/* Iconos en navegación */
.nav-buttons-container .icon {
    filter: brightness(0) invert(1) !important;
    opacity: 0.92 !important;
}

.nav-buttons-container .dxbl-btn-text {
    color: white !important;
    font-weight: 500 !important;
}

/* ============================
   DRAWER PANEL
   ============================ */
.navigation-drawer .dx-drawer-panel-content,
.dx-drawer .dx-drawer-panel-content {
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%) !important;
    color: white !important;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 992px) {
    .app-title {
        font-size: 1.15rem !important;
    }

    .nav-center-section {
        flex: 0.8 !important;
    }
}

@media (max-width: 768px) {
    .nav-buttons-container {
        padding: 8px 14px !important;
        height: 54px !important;
        gap: 10px !important;
    }

    .nav-buttons-container .menu-button,
    .nav-buttons-container .menu-button-nav {
        padding: 8px 14px !important;
        font-size: 14px !important;
        min-height: 36px !important;
    }

    .app-title {
        font-size: 1.05rem !important;
    }

    .app-title span {
        display: none !important;
    }

    .nav-left-section,
    .nav-right-section {
        gap: 8px !important;
    }

    .user-profile-link {
        padding: 12px 14px !important;
    }
}

@media (max-width: 576px) {
    .nav-buttons-container {
        padding: 6px 10px !important;
        height: 48px !important;
    }

    .menu-footer {
        padding: 14px !important;
    }

    .menu-footer-link,
    .menu-logout-button {
        padding: 11px 14px !important;
    }
}
