/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 76px;
    min-width: 76px;
    background-color: var(--bs-secondary-950);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-md) var(--spacing-sm);
    gap: var(--spacing-sm);
    margin-right: var(--spacing-md);
    height: 100%;
    align-self: stretch;
    z-index: 100;
    overflow: visible;
}

/* Sidebar Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xs);
    text-decoration: none;
}

.sidebar-logo-img {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
}

/* Logo/Brand at top */
.sidebar-nav .sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--bs-primary-400), var(--bs-primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
}

/* Divider */
.sidebar-nav .sidebar-divider {
    width: 32px;
    height: 1px;
    background-color: var(--bs-secondary-800);
    margin: var(--spacing-xs) 0;
}

/* Navigation items */
.sidebar-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 52px;
    border-radius: var(--radius-lg);
    color: #fff;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
    padding: 0;
}

.sidebar-nav-item:hover {
    background-color: var(--bs-secondary-900);
    color: var(--bs-white);
}

.sidebar-nav-item.active {
    background-color: var(--bs-primary-500);
    color: var(--bs-white);
}

.sidebar-nav-item svg,
.sidebar-nav-item i {
    width: 22px;
    height: 22px;
    font-size: 22px;
}

.sidebar-nav-item .nav-label {
    font-size: 0.65rem;
    margin-top: 2px;
    font-weight: 500;
    white-space: nowrap;
    color: inherit;
}

/* Tooltip on hover (optional - for icon-only mode) */
.sidebar-nav-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    margin-left: 8px;
    background: var(--bs-secondary-900);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
}

/* ==========================================================================
   Search Dropdown
   ========================================================================== */

.sidebar-search-dropdown {
    position: relative;
    overflow: visible;
}

.search-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--bs-primary-500);
    color: white;
    font-size: 0.6rem;
    font-weight: 600;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-dropdown-menu {
    display: none;
    position: absolute;
    left: calc(100% + 8px);
    bottom: -8px;
    background: var(--bs-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 250px;
    max-width: 320px;
    z-index: 9999;
    border: 1px solid var(--bs-gray-200);
}

.search-dropdown-menu.show {
    display: block;
}

.dropdown-header {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--bs-gray-100);
}

.dropdown-items {
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-empty {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--bs-gray-400);
    font-size: 0.875rem;
}

.dropdown-item-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item-tab:hover {
    background-color: var(--bs-gray-50);
}

.dropdown-item-tab.active {
    background-color: var(--bs-primary-50);
}

.dropdown-item-tab .tab-name {
    font-size: 0.875rem;
    color: var(--bs-gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.dropdown-item-tab .close-tab-btn {
    padding: 2px 6px;
    border: none;
    background: none;
    color: var(--bs-gray-400);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    line-height: 1;
    margin-left: var(--spacing-sm);
}

.dropdown-item-tab .close-tab-btn:hover {
    background-color: var(--bs-gray-200);
    color: var(--bs-gray-700);
}

/* ==========================================================================
   My Chats Dropdown
   ========================================================================== */

.sidebar-chats-dropdown {
    position: relative;
    overflow: visible;
}

.chats-dropdown-menu {
    display: none;
    position: absolute;
    left: calc(100% + 8px);
    top: -8px;
    background: var(--bs-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 260px;
    max-width: 340px;
    z-index: 9999;
    border: 1px solid var(--bs-gray-200);
}

.chats-dropdown-menu.show {
    display: block;
}

.chats-dropdown-menu .dropdown-items {
    max-height: 360px;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    gap: 2px;
}

.chat-item:hover {
    background-color: var(--bs-gray-50);
}

.chat-item.active-chat {
    background-color: var(--bs-primary-50, #fff7ed);
}

.chat-item-title {
    font-size: 0.85rem;
    color: var(--bs-gray-700);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-date {
    font-size: 0.7rem;
    color: var(--bs-gray-400);
}

/* Spacer to push bottom icons down */
.sidebar-spacer {
    flex: 1;
}

/* ==========================================================================
   Settings Dropdown
   ========================================================================== */

.sidebar-settings-dropdown {
    position: relative;
    overflow: visible;
}

.settings-dropdown-menu {
    display: none;
    position: absolute;
    left: calc(100% + 8px);
    bottom: 0;
    background: var(--bs-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 180px;
    z-index: 9999;
    border: 1px solid var(--bs-gray-200);
    padding: var(--spacing-sm);
}

.settings-dropdown-menu.show {
    display: block;
}

.dropdown-item-settings {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--bs-gray-700);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.875rem;
    cursor: pointer;
}

.dropdown-item-settings:hover {
    background-color: var(--bs-gray-100);
    color: var(--bs-gray-800);
}

.dropdown-item-settings i {
    width: 16px;
    text-align: center;
    color: var(--bs-gray-500);
}

.settings-divider {
    height: 1px;
    background-color: var(--bs-gray-200);
    margin: var(--spacing-xs) 0;
}

.logout-form {
    margin: 0;
}

/* Hide on mobile - use bottom nav instead */
@media (max-width: 576px) {
    .sidebar-nav {
        display: none;
    }
}