/* Sidebar CSS Variables */
:root {
    --sidebar-bg: rgb(32, 32, 35);
    --sidebar-border: #374151;
    --sidebar-text-white: white;
    --sidebar-text-gray: #9ca3af;
    --sidebar-active-bg: #2a5298;
    --sidebar-hover-bg: rgba(116, 116, 128, 0.25);
    --sidebar-header-bg: rgba(55, 65, 81, 0.5);
    --sidebar-icon-size: 20px;
    --sidebar-border-radius: 8px;
    --sidebar-gap: 16px;
    --sidebar-padding-horizontal: 20px;
}

:root[data-theme="dark"] {
    --sidebar-active-bg: #5b8bc4;
}

:root[data-theme="light"] {
    --sidebar-bg: #f8f9fa;
    --sidebar-border: #e9ecef;
    --sidebar-text-white: #212529;
    --sidebar-text-gray: #6c757d;
    --sidebar-active-bg: #2a5298;
    --sidebar-hover-bg: rgb(229, 229, 234);
    --sidebar-header-bg: rgba(116, 116, 128, 0.1);
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 20px;
    left: -300px;
    width: 300px;
    height: calc(100vh - 40px);
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    z-index: 2000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar.active {
    left: 20px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--sidebar-text-white);
    margin: 0;
}

.sidebar-content {
    padding: 8px 0;
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px var(--sidebar-padding-horizontal);
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--sidebar-text-gray);
    background-color: var(--sidebar-header-bg);
}

.section-title {
    padding: 12px var(--sidebar-padding-horizontal) 8px var(--sidebar-padding-horizontal);
    font-size: 13px;
    font-weight: 500;
    color: var(--sidebar-text-gray);
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sidebar-gap);
    padding: 8px var(--sidebar-padding-horizontal);
    margin: 2px 8px;
    border-radius: var(--sidebar-border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--sidebar-text-white);
    background: transparent;
}

.nav-item:hover {
    border-radius: calc(var(--sidebar-border-radius) * 1.5);
}

/* Override for dropdown menu items */
.dropdown-menu .nav-item:hover {
    border-radius: calc(var(--sidebar-border-radius) * 1.5);
}

.nav-item:hover {
    background-color: var(--sidebar-hover-bg);
}

.nav-item.active {
    background-color: var(--sidebar-active-bg);
    border-radius: var(--sidebar-border-radius);
}

.nav-icon {
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    filter: brightness(0) saturate(100%) invert(42%) sepia(93%) saturate(1352%) hue-rotate(187deg) brightness(91%) contrast(86%);
}

.nav-icon[fill] {
    fill: var(--sidebar-active-bg) !important;
}

.nav-item.active .nav-icon {
    filter: brightness(0) saturate(100%) invert(100%);
}

.nav-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.nav-item:hover .nav-menu-btn,
.nav-item.active .nav-menu-btn {
    opacity: 1;
}

.nav-menu-btn:hover {
    background-color: rgba(116, 116, 128, 0.2);
}

.menu-icon {
    width: 14px;
    height: 14px;
    filter: brightness(0) saturate(100%) invert(0%);
}

/* Light mode: Ellipsis white only when active */
:root[data-theme="light"] .nav-item.active .menu-icon {
    filter: brightness(0) saturate(100%) invert(100%);
}

/* Dark mode: Ellipsis white when active and hover */
.nav-item.active .menu-icon,
.nav-item:hover .menu-icon {
    filter: brightness(0) saturate(100%) invert(100%);
}

/* Light Mode Text Color Override */
:root[data-theme="light"] .nav-item.active {
    color: white !important;
}

:root[data-theme="light"] .nav-item:hover .nav-menu-btn,
:root[data-theme="light"] .nav-item.active .nav-menu-btn {
    opacity: 1;
}

/* Dropdown Menu Styles */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 8px;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 3000;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-item {
    position: relative;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--sidebar-text-white);
    transition: all 0.2s ease;
    font-size: 14px;
    border-radius: var(--sidebar-border-radius);
}

.menu-item:hover {
    background-color: var(--sidebar-hover-bg);
    border-radius: calc(var(--sidebar-border-radius) * 1.5);
}

.menu-item-icon {
    width: 16px;
    height: 16px;
    filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(187deg) brightness(91%) contrast(95%);
}

:root[data-theme="light"] .menu-item-icon {
    filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(187deg) brightness(91%) contrast(95%);
}

/* Red icon for delete action */
.delete-item .menu-item-icon {
    filter: brightness(0) saturate(100%) invert(25%) sepia(74%) saturate(2277%) hue-rotate(356deg) brightness(95%) contrast(92%);
}

:root[data-theme="light"] .delete-item .menu-item-icon {
    filter: brightness(0) saturate(100%) invert(25%) sepia(74%) saturate(2277%) hue-rotate(356deg) brightness(95%) contrast(92%);
}
