/* EpochOS SideNav Styles - Combined */
/* Place this in wwwroot/css/app.css or site.css */

/* CSS Variables */
:root {
    --sidenav-width: 250px;
    --sidenav-collapsed-width: 64px;
    --header-height: 56px;
}

/* Main Sidenav Container */
.sidenav {
    position: fixed;
    width: var(--sidenav-width);
    height: 100vh;
    top: 0;
    left: 0;
    background-color: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 1000;
    overflow: visible;
}

    .sidenav.collapsed {
        width: var(--sidenav-collapsed-width);
        overflow: visible;
    }

        /* Hide text and children by default in collapsed state */
        .sidenav.collapsed .nav-text,
        .sidenav.collapsed .company-info,
        .sidenav.collapsed .profile-info,
        .sidenav.collapsed .dropdown-arrow,
        .sidenav.collapsed .nav-children,
        .sidenav.collapsed .chevron {
            display: none !important;
        }

        /* Make collapsed sidenav clickable to expand */
        .sidenav.collapsed {
            cursor: pointer;
        }

/* Collapse Toggle Button Styling */
.sidenav-toggle {
    position: fixed;
    bottom: 10%;
    left: 250px; /* Position at the right edge of expanded sidenav */
    transform: translateY(-50%);
    width: 24px;
    height: 30px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: none;
    border-radius: 0 6px 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 950; /* Lower than dropdowns so menus overlay the arrow */
    transition: all 0.3s ease;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.sidenav-toggle:hover {
    background-color: #f9fafb;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.15);
}

.sidenav-toggle .chevron-icon {
    font-size: 12px;
    color: #6b7280;
    transition: transform 0.3s ease;
}

/* When sidenav is collapsed, move toggle button */
.sidenav.collapsed ~ .sidenav-toggle {
    left: 64px;
}

.sidenav.collapsed ~ .sidenav-toggle .chevron-icon {
    transform: rotate(180deg);
}




/* Company Section */
.company-section {
    padding: 4px 8px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
    overflow: visible;
}

.company-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

    .company-selector:hover {
        background-color: #f3f4f6;
    }

.company-icon {
    width: 32px;
    height: 32px;
    background-color: #000000;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.company-info {
    flex: 1;
    min-width: 0;
}

.company-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company-label {
    font-size: 12px;
    color: #6b7280;
}

.dropdown-arrow {
    color: #6b7280;
    font-size: 12px;
    transition: transform 0.2s;
}

    .dropdown-arrow i.rotate {
        transform: rotate(180deg);
    }

/* Navigation Items */
.nav-items {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #4b5563;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

    .nav-link:focus {
        outline: 2px solid #e5e7eb;
    }

    .nav-link:hover,
    .nav-item:hover {
        background-color: #f3f4f6;
        color: #111827;
    }

.nav-item.active {
    background-color: #f3f4f6;
    color: #111827;
    font-weight: 600;
}

/* Blazor NavLink support */
.nav-item ::deep a {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    color: inherit;
    text-decoration: none;
}

.nav-item a.active {
    background-color: #f3f4f6;
    color: #111827;
    font-weight: 600;
}

.nav-item i:first-child {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.nav-item.has-children {
    justify-content: space-between;
}

.nav-item .chevron {
    font-size: 12px;
    transition: transform 0.2s;
    margin-left: auto;
}

.nav-item.expanded .chevron {
    transform: rotate(180deg);
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Child Navigation Items */
.nav-children {
    display: flex;
    flex-direction: column;
    margin-left: 32px;
}

.nav-child {
    display: block;
    padding: 6px 12px;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s;
}

    .nav-child:hover {
        background-color: #f3f4f6;
        color: #29303a
    }

    .nav-child.active {
        background-color: #f3f4f6;
        color: #111827;
        font-weight: 600;
    }

.nav-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 8px 0;
}

/* Profile Section */
.profile-section {
    border-top: 1px solid #e5e7eb;
    padding: 4px 8px;
    position: relative;
    overflow: visible;
}

.profile-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

    .profile-selector:hover {
        background-color: #f3f4f6;
    }

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-email {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dropdown Menus */
.dropdown-menu,
.company-dropdown,
.profile-dropdown {
    display: block;
}

/* Ensure sidenav dropdowns overlay the collapse arrows */
.sidenav .dropdown-menu {
	position: absolute;
	z-index: 1102;
}

.profile-dropdown {
    top: 0;
    left: 100%;
    transform: translateY(-68%);
    margin-left: 5px;

}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.15rem 0.75rem 0.45rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.dropdown-search {
    position: relative;
    padding: 8px 16px;
    border-bottom: 1px solid #e5e7eb;
}

    .dropdown-search i {
        position: absolute;
        left: 28px;
        top: 50%;
        transform: translateY(-50%);
        color: #9ca3af;
        font-size: 12px;
    }

    .dropdown-search input {
        width: 100%;
        padding: 6px 12px 6px 32px;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        font-size: 14px;
        outline: none;
    }

        .dropdown-search input:focus {
            border-color: #3b82f6;
        }

.dropdown-items {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

    .dropdown-item:hover {
        background-color: #f3f4f6;
    }

    .dropdown-item.active {
        background-color: #f3f4f6;
        color: #111827;
        font-weight: 600;
    }

    .dropdown-item i {
        width: 16px;
        text-align: center;
        color: #6b7280;
    }

    .dropdown-item .item-name {
        flex: 1;
    }

    .dropdown-item .item-shortcut {
        font-size: 12px;
        color: #9ca3af;
    }

.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 8px 0;
}

.dropdown-item.logout {
    color: #ef4444;
}

    .dropdown-item.logout i {
        color: #ef4444;
    }

/* Collapsed State Specific Styles */
.sidenav.collapsed .company-selector,
.sidenav.collapsed .profile-selector {
    justify-content: center;
}

.sidenav.collapsed .nav-item {
    justify-content: center;
}

    .sidenav.collapsed .nav-item i:first-child {
        margin: 0;
    }

/* Icon Button */
.icon-button {
    width: 32px;
    height: 32px;
    border: none;
    background-color: transparent;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
}

    .icon-button:hover {
        background-color: #f3f4f6;
        color: #111827;
    }

/* Scrollbar Styling */
.nav-items::-webkit-scrollbar,
.dropdown-items::-webkit-scrollbar {
    width: 6px;
}

.nav-items::-webkit-scrollbar-track,
.dropdown-items::-webkit-scrollbar-track {
    background: transparent;
}

.nav-items::-webkit-scrollbar-thumb,
.dropdown-items::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 3px;
}

    .nav-items::-webkit-scrollbar-thumb:hover,
    .dropdown-items::-webkit-scrollbar-thumb:hover {
        background-color: #9ca3af;
    }

/* Smooth transitions */
.sidenav * {
    transition: all 0.2s ease;
}

/* Tooltip for collapsed items */
.sidenav.collapsed .nav-item:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    padding: 4px 8px;
    background-color: #1f2937;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1051;
}

/* Responsive - Mobile Overlay */
@media (max-width: 768px) {
    .sidenav {
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

        .sidenav.mobile-open {
            transform: translateX(0);
        }

    .sidenav-overlay {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
        height: calc(100vh - var(--header-height));
    }

        .sidenav-overlay.show {
            display: block;
        }
}
