/* ========== SIDEBAR REDESIGN - Two-Panel Navigation ========== */

/* Professional Sidebar - Compact Category View - Wazuh Style */
.sidebar {
    width: 220px;
    background: #082433 !important;
    border-right: 1px solid rgba(215, 239, 248, 0.14) !important;
    position: fixed;
    height: calc(100vh - 65px);
    /* Outer aside stays visible so position:fixed subcategory panel is not clipped by overflow */
    overflow-x: visible;
    overflow-y: visible;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
}

/* Scroll lives here; flyout panel stays a direct child of .sidebar */
.sidebar-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: visible;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

/* Hide submenus by default in sidebar */
.sidebar-section .submenu {
    display: none !important;
}

/* Category Header - Professional Design - Wazuh Style */
.sidebar-title.category-header {
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: 0.1px;
    color: #ffffff !important;
    padding: 0.75rem 1rem !important;
    margin-bottom: 0.25rem !important;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    user-select: none;
    background: transparent;
}

.sidebar-title.category-header:hover {
    background: #0d3a50 !important;
    color: #00bceb !important;
    transform: translateX(2px);
}

.sidebar-title.category-header .category-icon {
    width: 18px;
    height: 18px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    opacity: 0.9;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    color: #ffffff !important;
    visibility: visible !important;
}

.sidebar-title.category-header:hover .category-icon {
    opacity: 1;
    color: #00bceb;
}

.sidebar-title.category-header .category-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: inherit;
    flex: 1;
}

/* Active category indicator - Wazuh Style */
.sidebar-section:has(.submenu .active) .category-header {
    background: #0d3a50 !important;
    color: #00bceb !important;
    font-weight: 600 !important;
}

.sidebar-section:has(.submenu .active) .category-header::before {
    content: '';
    position: absolute;
    left: 0;
    width: 3px;
    height: 60%;
    background: #00bceb;
    border-radius: 0 2px 2px 0;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 8px rgba(0, 188, 235, 0.45);
}

/* Right-Side Subcategory Panel - Wazuh Style - Compact - Positioned next to category */
.sidebar-subcategory-panel {
    position: fixed;
    left: var(--app-sidebar-width, 220px);
    top: 65px;
    width: 260px;
    min-height: 100px;
    max-height: 600px;
    background: #0d2735;
    border-right: 1px solid rgba(215, 239, 248, 0.14);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    /* Above main content and header-adjacent UI so flyout links stay clickable */
    z-index: 1200;
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-radius: 0 8px 8px 0;
    overflow: hidden;
}

.sidebar-subcategory-panel.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.subcategory-panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(215, 239, 248, 0.14);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #082433;
    flex-shrink: 0;
}

.subcategory-panel-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #00bceb;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.subcategory-panel-close {
    background: transparent;
    border: none;
    color: #b7ccd8;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.subcategory-panel-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.subcategory-panel-content {
    flex: 0 1 auto;
    overflow-y: auto;
    padding: 0.5rem 0;
    min-height: 50px;
    max-height: calc(100% - 60px);
}

.subcategory-panel-placeholder {
    padding: 2rem 1.5rem;
    text-align: center;
    color: #b7ccd8;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Subcategory Menu Items - Only show items for selected category */
.subcategory-panel-content .sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: block !important;
    width: 100%;
}

.subcategory-panel-content .sidebar-menu li {
    margin: 0;
    padding: 0;
    width: 100%;
}

.subcategory-panel-content .sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.subcategory-panel-content .sidebar-menu li {
    margin: 0;
    padding: 0;
}

.subcategory-panel-content .sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.625rem 1.25rem;
    color: #ffffff;
    text-decoration: none;
    border-radius: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    position: relative;
    font-weight: 400;
    margin: 0;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.subcategory-panel-content .sidebar-menu a:hover {
    background: #082433;
    color: #00bceb;
    border-left-color: #00bceb;
    padding-left: 1.75rem;
}

.subcategory-panel-content .sidebar-menu a i {
    width: 20px;
    text-align: center;
    font-size: 0.875rem;
    opacity: 0.9;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    color: inherit;
}

.subcategory-panel-content .sidebar-menu a:hover i {
    opacity: 1;
}

.subcategory-panel-content .sidebar-menu a.active {
    background: #082433;
    color: #00bceb;
    font-weight: 500;
    border-left-color: #00bceb;
}

.subcategory-panel-content .sidebar-menu a.active i {
    opacity: 1;
    color: #00bceb;
}

.subcategory-panel-content .sidebar-menu .badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Adjust main content margin when panel is active */
.main-content {
    margin-left: 220px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.panel-active {
    margin-left: 480px;
}

/* Custom scrollbar for subcategory panel */
.subcategory-panel-content::-webkit-scrollbar {
    width: 6px;
}

.subcategory-panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.subcategory-panel-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.subcategory-panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .sidebar-subcategory-panel {
        width: 280px;
    }
    .main-content.panel-active {
        margin-left: 500px;
    }
}
