/* sidebar.css */


/* Recent */
.recent-pre-collapsed .chat-history-section {
    max-height: 0;
}

.recent-pre-collapsed .chat-history-section .chat-list {
    max-height: 0;
    overflow: hidden;
}

.recent-pre-collapsed .recent-arrow {
    transform: rotate(-90deg);
}


/* Disable animations during pre-hydration */
.sidebar-pre-expanded .sidebar *,
.recent-pre-collapsed .chat-history-section *{
    transition: none !important;
}

/* Prevent project loader flash before JS hydration */
html:not(.js-ready) .projects-list {
    display: none;
}


:root {
    --primary-text: #0B2F4E;  /* Match AI assistant body text */
    --secondary-text: #666;
    --divider-color: rgba(27, 145, 248, 0.1);
    --sidebar-bg: #FFFFFF;
    --sidebar-width-closed: 60px;
    --sidebar-width-open: 235px;
    --transition-speed: 0.3s;
    --font-inter: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;  /* Match AI assistant font stack */
}

/* ===== BODY LAYOUT ===== */
body {
    margin: 0;
    padding: 0;
}


/* ===== SIDEBAR BASE ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    width: var(--sidebar-width-closed);
    background: var(--sidebar-bg);
    border-right: 1px solid #e5e7eb !important;
    transition: width var(--transition-speed) ease;
    z-index: 1000;
    overflow: hidden;
}

.sidebar.expanded {
    width: var(--sidebar-width-open);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow-y: hidden; /* [YES] Changed from auto to hidden */
    overflow-x: hidden;
}

/* ===== HEADER (Logo & Shuttle) ===== */
.sidebar-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0px 12px;
    min-height: 45px;
    border-bottom: 0px solid var(--divider-color);
    flex-shrink: 0;
}

.logo-container {
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    position: relative;
    width: 36px;
    height: 36px;
    transition: width var(--transition-speed) ease;
}

.logo-icon {
    width: 36px;
    height: 36px;
    display: block;
    transition: opacity var(--transition-speed) ease;
}


.sidebar:not(.expanded) .logo-container:hover .logo-icon {
    opacity: 0;
}

.logo-full {
    position: absolute;
    left: 0;
    height: 25px;
    width: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
    display: none; /* ADDED - Never show full logo */
}

/* Sidebar Shuttle - Hover on Logo */
.sidebar-shuttle-hover {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, background var(--transition-speed) ease;
    padding: 0;
    /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
    border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.sidebar:not(.expanded) .logo-container:hover .sidebar-shuttle-hover {
    opacity: 1;
    pointer-events: all;
}

.sidebar-shuttle-hover img {
    width: 20px;
    height: 20px;
}

/* Sidebar Shuttle - Expanded State */
.sidebar-shuttle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--transition-speed) ease;
    padding: 0;
    /* outline: 0.5px solid transparent; */
    border: 0.5px solid transparent;
}

.sidebar-shuttle:hover {
    /* background: rgba(27, 145, 248, 0.1); */
    /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
    border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.sidebar-shuttle img {
    width: 20px;
    height: 20px;
    transition: transform var(--transition-speed) ease;
}

.sidebar.expanded .sidebar-shuttle {
    display: flex;
}

.sidebar.expanded .sidebar-shuttle img {
    transform: rotate(180deg);
}

/* ===== NAVIGATION ===== */
.sidebar-nav {
    padding: 1px 7px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    position: relative;
}

.nav-link-sidebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
    border-radius: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background var(--transition-speed) ease;
    width: 100%;
    text-decoration: none;
    color: var(--primary-text);
    font-family: var(--font-inter);
    font-size: 0.875rem;  /* 14px */
    font-weight: 400;
    /* outline: 0.5px solid transparent; */
    border: 0.5px solid transparent;
}

.nav-link-sidebar:hover {
    /* background: #F1F7FF; */
    /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
    border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.nav-link-sidebar img:first-child {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Update all font families and sizes to match */
.nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--transition-speed) ease;
    font-family: var(--font-inter);
    font-size: 0.875rem;  /* 14px - matches AI assistant */
    font-weight: 400;
    color: var(--primary-text);
}

.sidebar.expanded .nav-label {
    opacity: 1;
    width: auto;
}

.nav-arrow {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform var(--transition-speed) ease;
    opacity: 0;
}

.sidebar.expanded .nav-arrow {
    opacity: 1;
}

/* Rotate arrow for expanded projects */
.nav-item.expandable.open .nav-arrow.rotate {
    transform: rotate(90deg);
}

/* Tooltip for closed sidebar */
.sidebar:not(.expanded) .nav-item::after,
.sidebar:not(.expanded) .user-profile::after,
.sidebar:not(.expanded) .sidebar-shuttle-hover::after {
    content: attr(data-label);
    position: fixed;
    left: var(--tooltip-x);
    top: var(--tooltip-y);
    transform: translateY(-50%);
    background: var(--primary-text);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: var(--font-inter);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 3000;
}

/* Do NOT show tooltip unless position is set */
.sidebar:not(.expanded) .nav-item::after,
.sidebar:not(.expanded) .user-profile::after,
.sidebar:not(.expanded) .sidebar-shuttle-hover::after {
    opacity: 0;
}

.sidebar:not(.expanded) .nav-item:hover::after,
.sidebar:not(.expanded) .user-profile:hover::after,
.sidebar:not(.expanded) .sidebar-shuttle-hover:hover::after {
    opacity: 1;
}

/* ===== PROJECTS LIST ===== */
.projects-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-speed) ease;
    padding: 0;
}
/* [YES] Show projects when it has .show class (added by JavaScript) */
/* [YES] KEEP ONLY THIS */
.projects-list.show {
    max-height: none !important;
    overflow: visible !important;
    padding: 0 7px 0px !important;
}


/* Hide projects list when sidebar is closed */
.sidebar:not(.expanded) .projects-list {
    display: none !important;
}

.nav-item.expandable.open .projects-list {
    max-height: none; /* Remove max-height */
    overflow-y: visible; /* Changed from auto */
    margin-top: 0px;
    padding: 0 7px 16px;
}


.project-item-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--primary-text);
    font-family: var(--font-inter);
    font-size: 0.8125rem;  /* 13px */
    font-weight: 400;
    transition: background var(--transition-speed) ease;
}

.project-item-link:hover {
    background: #F1F7FF;
}

/* ===== CHAT HISTORY ===== */
.chat-history-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: visible; /* [YES] No individual scroll */
}

.recent-label {
    padding: 16px 20px 8px;
    font-family: var(--font-inter);
    font-size: 0.75rem;  /* 12px */
    font-weight: 600;
    color: var(--secondary-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease, height var(--transition-speed) ease;
}

.sidebar.expanded .recent-label {
    opacity: 1;
    height: auto;
}

.dropdown-menu .dropdown-item:active {
  background-color: transparent !important;
  color: inherit !important;
  filter: none !important;
  transform: none !important;
}
.chat-list {
    flex: 1;
    overflow: visible; /* [YES] No individual scroll */
    padding: 0 7px 16px;
    display: flex;
    flex-direction: column;
    gap: 0px;
}

/* Hide scrollbar when sidebar is closed */
.sidebar:not(.expanded) .chat-list {
    overflow-y: hidden;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 0px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--primary-text);
    font-family: var(--font-inter);
    font-size: 0.875rem;  /* 14px */
    font-weight: 400;
    transition: background var(--transition-speed) ease;
    cursor: pointer;
    min-height: 32px;
    position: relative;
    margin-bottom: 2px;
    /* outline: 0.5px solid transparent; */
    border: 0.5px solid transparent;
}

/* Three Dot Menu - Only show on hover, stay visible when dropdown is open */
.chat-menu-wrapper {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
}

/* Show menu on chat hover OR when dropdown is open */
.chat-item:hover .chat-menu-wrapper,
.chat-menu-wrapper.show {
    opacity: 1;
}

.chat-menu-wrapper.show {
    z-index: 1200 !important; /* ✅ Above everything in sidebar */
}

.chat-menu-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: background 0.2s;
    position: relative; /* ✅ Create stacking context */
    z-index: 1101; /* ✅ Button stays above dropdown trigger area */
}

.chat-menu-btn i {
    font-size: 0.875rem;
}

.sidebar:not(.expanded) .chat-item {
    pointer-events: none;
}

.sidebar.expanded .chat-item:hover {
    background: transparent !important;
    /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
    border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.chat-title {
    font-family: var(--font-inter);
    font-size: 0.875rem;  /* 14px */
    font-weight: 400;  /* Normal weight like AI messages */
    color: var(--primary-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0;
    width: 0;
    transition: opacity var(--transition-speed) ease;
    max-width: 175px;
}

.sidebar.expanded .chat-title {
    opacity: 1;
    width: auto;
}

.no-chats {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--secondary-text);
    font-family: var(--font-inter);
    font-size: 0.8125rem;  /* 13px */
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease, height var(--transition-speed) ease;
}

.sidebar.expanded .no-chats {
    opacity: 1;
    height: auto;
}

/* ===== BOTTOM SECTION (Login/Profile) ===== */
.sidebar-bottom {
    position: relative;
    margin-top: auto;
    background: var(--sidebar-bg);
}


/* Bottom divider - only show when expanded */
.bottom-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

.sidebar.expanded .bottom-divider {
    opacity: 1;
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background var(--transition-speed) ease;
    gap: 0.75rem;
    padding: 0.75rem;
    width: 90%;
    max-width: 100%;
    background: transparent !important;
    border-radius: 8px;
    text-align: left;
    margin: 8px;
    /* outline: 0.5px solid transparent; */
    border: 0.5px solid transparent !important;
}

.user-profile:hover{
    /* background: #F1F7FF !important; */
    /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
    border: 0.5px solid rgba(27, 145, 248, 0.4) !important;
}

.user-avatar:hover {
    border: none !important;
}

.user-avatar {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    color: black;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0.5px solid transparent !important;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    flex: 1;
    overflow: hidden;
    opacity: 0;
    width: 0;
    transition: opacity var(--transition-speed) ease;
}

.sidebar.expanded .user-info {
    opacity: 1;
    width: auto;
}

.user-name {
    font-family: var(--font-inter);
    font-size: 0.875rem;  /* 14px */
    font-weight: 600;
    color: var(--primary-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-plan {
    font-family: var(--font-inter);
    font-size: 0.75rem;  /* 12px */
    color: var(--secondary-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Login Section */
.login-section {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--primary-text);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-family: var(--font-inter);
    font-size: 0.875rem;  /* 14px */
    font-weight: 500;
    transition: background var(--transition-speed) ease;
}

.btn-login:hover {
    background: rgba(11, 47, 78, 0.9);
    color: white;
}

.btn-login img {
    width: 16px;
    height: 16px;
}

.btn-login span {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease;
}

.sidebar.expanded .btn-login {
    justify-content: flex-start;
}

.sidebar.expanded .btn-login span {
    opacity: 1;
    width: auto;
}

.login-divider {
    text-align: center;
    color: var(--secondary-text);
    font-family: var(--font-inter);
    font-size: 0.75rem;  /* 12px */
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease, height var(--transition-speed) ease;
}

.sidebar.expanded .login-divider {
    opacity: 1;
    height: auto;
}

.btn-signup {
    display: block;
    text-align: center;
    padding: 10px 16px;
    background: transparent;
    color: var(--primary-text);
    border: 1px solid var(--divider-color);
    border-radius: 8px;
    text-decoration: none;
    font-family: var(--font-inter);
    font-size: 0.875rem;  /* 14px */
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    opacity: 0;
    height: 0;
    overflow: hidden;
    padding: 0;
}

.sidebar.expanded .btn-signup {
    opacity: 1;
    height: auto;
    padding: 10px 16px;
}

.btn-signup:hover {
    background: #F1F7FF;
    color: var(--primary-text);
}

/* ===== RECENT HEADER WITH DROPDOWN ===== */
.recent-header {
    flex-shrink: 0;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease, max-height var(--transition-speed) ease;
     padding: 0 7px;
}

.sidebar.expanded .recent-header {
    opacity: 1;
    max-height: 60px;
}

.recent-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    margin: 8px 0 2px 0;
    border-radius: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font-inter);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background var(--transition-speed) ease;
    /* outline: 0.5px solid transparent; */
    border: 0.5px solid transparent;
}

.recent-toggle:hover {
    /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
    border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.recent-arrow {
    font-size: 0.75rem;
    transition: transform var(--transition-speed) ease;
    color: var(--primary-text);
}

.chat-history-section.collapsed .recent-arrow {
    transform: rotate(-90deg);
}

.chat-history-section.collapsed .chat-list {
    max-height: 0;
    overflow: hidden;
    padding: 0 8px;
}

/* Remove old recent-label styles */
.recent-label {
    display: none;
}
/* ===== PROJECTS WITH INLINE EXPANSION ===== */
.project-item {
    margin-bottom: 2px;
    max-width: 100%; /* [YES] Prevent overflow */
    overflow: visible; /* [YES] Clip anything that overflows */
}
/* Special items (New Project, All Projects) */
.project-item.special-item .project-name {
    max-width: 150px; /* [YES] Slightly wider for special items */
}

.project-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* padding: 2px 12px; */
    padding: 2px 12px 0px 7px;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition-speed) ease;
    color: var(--primary-text);
    text-decoration: none;
    max-width: 100%;
    background: transparent;
    border: none;
    width: 100%;
    /* outline: 0.5px solid transparent; */
    border: 0.5px solid transparent;

}

.project-header:hover {
    /* background: #F1F7FF; */
    /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
    border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.project-title {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    font-family: var(--font-inter);
    font-size: 0.875rem;
    font-weight: 400;
    flex: 1;

    padding: 0px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--primary-text);
    font-family: var(--font-inter);
    font-size: 0.875rem;
    font-weight: 400;
    transition: background var(--transition-speed) ease;
    cursor: pointer;
    min-height: 25px;
    position: relative;
}

.project-icon {
    font-size: 16px;
    color: var(--secondary-text);
}

.project-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
    max-width: 125px;
}
/* Pin icon at the right end */
.project-pin-icon {
    margin-left: auto !important;
    flex-shrink: 0;
    color: #6b7280;
    font-size: 0.75rem;
}

.chat-count {
    font-size: 0.75rem;
    color: var(--secondary-text);
    margin-left: 4px;
}

.project-chevron {
    font-size: 0.75rem;
    color: var(--secondary-text);
    transition: transform var(--transition-speed) ease;
    flex-shrink: 0; /* [YES] Never shrink */
}

/* Expanded state */
.project-item.open .project-chevron {
    transform: rotate(90deg);
}

.project-item.special-item .project-icon {
    color: #1d4ed8;
}

/* Project chats list (inline) */
.project-chats-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-speed) ease;
}

.project-item.open .project-chats-list {
    max-height: none; /* ✅ No limit - expands to fit all chats */
    overflow-y: visible; /* ✅ No scrollbar */
    overflow-x: hidden;
    margin-top: 4px;
    padding-bottom: 4px;
    overflow: visible;
}

.project-chat-item {
    display: block;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--primary-text);
    font-family: var(--font-inter);
    font-size: 0.8125rem;
    transition: background var(--transition-speed) ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.project-chat-item:hover {
    background: #F1F7FF;
}

.project-no-chats,
.project-loading {
    padding: 8px 12px;
    text-align: center;
    color: var(--secondary-text);
    font-size: 0.8125rem;
}


/* Project Selection Modal */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.project-option:hover {
    background: #F1F7FF;
    border-color: #3b82f6;
}

.project-option i {
    font-size: 1.125rem;
    color: #6b7280;
}

.project-option span {
    font-size: 0.9375rem;
    color: #1a1a1a;
}

.project-option.create-new {
    border-style: dashed;
}

.project-option.create-new i {
    color: #3b82f6;
}

.project-option.create-new span {
    color: #3b82f6;
}
/* Rename */
/* Chat title editable state */
.chat-title[contenteditable="true"] {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
    padding: 2px 4px;
    outline: 2px solid #3b82f6;
    cursor: text;
}

.chat-title[contenteditable="true"]:focus {
    outline: 2px solid #3b82f6;
}

/* Prevent navigation when editing */
.chat-item.editing {
    pointer-events: none;
}

.chat-item.editing .chat-title {
    pointer-events: all;
}
/* Chat item in deleting state */
.chat-item.deleting {
    background: #fef2f3 !important;
    position: relative;
    z-index: 1100;
}

.chat-item.deleting:hover {
    background: #fef2f3 !important;
}

/* Make sure buttons are clickable */
.chat-item.deleting button {
    pointer-events: all !important;
    cursor: pointer !important;
    background-color: #EC404E ;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .main-content-wrapper {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.expanded {
        transform: translateX(0);
    }

    .main-content-wrapper.sidebar-expanded {
        margin-left: 0;
    }
}
/* ===== COLLAPSED SIDEBAR DROPDOWN ===== */


.loading-projects.hidden {
    display: none;
}

.profile-dropdown-divider {
    height: 1px;
    background: #E5E7EB; /* [YES] Darker divider */
    margin: 4px 0;
}


.loading-projects.hidden {
    display: none;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--divider-color);
    margin: 4px 0;
}
/* Login Section - Match User Profile */
.login-section {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.login-section .user-profile {
    margin: 0;
    text-decoration: none; /* Ensure no underline on link */
}

.login-section .user-avatar {
    background: #F1F7FF;
}
/* ===== GUEST TOAST NOTIFICATION ===== */
.guest-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-inter);
    font-size: 0.875rem;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.guest-toast a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 500;
}

.guest-toast a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.guest-toast .close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    line-height: 1;
    opacity: 0.7;
}

.guest-toast .close:hover {
    opacity: 1;
}

.guest-toast span:not(.close) {
    white-space: nowrap;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .guest-toast {
        left: 10px;
        right: 10px;
        transform: none;
        max-width: calc(100% - 20px);
    }

    .guest-toast span:not(.close) {
        white-space: normal;
    }
}
/* Hide mobile toggle when sidebar is expanded */
body.sidebar-open .mobile-header-toggle {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* OR if you want it to slide away smoothly */
body.sidebar-open .mobile-header-toggle {
  transform: translateX(-60px) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}


/* When sidebar is collapsed, nav links should only be 60px wide (icon only) */
.sidebar:not(.expanded) .nav-link-sidebar {
    width: 46px !important; /* 60px sidebar - 14px padding */
    padding: 7px 7px !important;
    justify-content: center;
    /* outline: 0.5px solid transparent; */
    border: 0.5px solid transparent;
}

/* When sidebar is collapsed, nav items should not overflow */
.sidebar:not(.expanded) .nav-item {
    width: 46px;
    overflow: hidden;
}

/* Hide the arrow when collapsed */
.sidebar:not(.expanded) .nav-arrow {
    display: none !important;
}

/* Ensure nav labels are completely hidden */
.sidebar:not(.expanded) .nav-label {
    display: none !important;
}

/* Fix hover area to match icon size only */
.sidebar:not(.expanded) .nav-link-sidebar:hover {
    /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
    border: 0.5px solid rgba(27, 145, 248, 0.4);
}

/* Make sure sidebar nav container doesn't overflow */
.sidebar:not(.expanded) .sidebar-nav {
    width: 60px;
    overflow: hidden;
}

/* New scrollable section for Projects + Recent */
.sidebar-scrollable-section {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding-top: 4px; /* Small spacing from AI Tools */
}

/* Scrollbar for this section */
.sidebar.expanded .sidebar-scrollable-section::-webkit-scrollbar {
    width: 4px;
}

.sidebar.expanded .sidebar-scrollable-section::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar.expanded .sidebar-scrollable-section::-webkit-scrollbar-thumb {
    background: rgba(27, 145, 248, 0.2);
    border-radius: 2px;
}

.sidebar.expanded .sidebar-scrollable-section::-webkit-scrollbar-thumb:hover {
    background: rgba(27, 145, 248, 0.3);
}

/* Hide scrollbar when collapsed */
.sidebar:not(.expanded) .sidebar-scrollable-section {
    overflow-y: hidden;
}

/* Highlighted current chat in Recent section */
.chat-item.active {
    /* font-weight: 500;
    /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
    border: 0.5px solid rgba(27, 145, 248, 0.4);
    color: #334EAC !important;
    font-weight: 500;
}

.chat-item.active .chat-title {
    font-weight: 500;
    color: #334EAC;
}

.chat-item.active:hover {
    background: rgba(29, 78, 216, 0.15) !important;
}

/* Highlighted chat in project section */
.project-chat-item.active {
    background: rgba(29, 78, 216, 0.1) !important;
    color: #1d4ed8;
    font-weight: 500;
}

.project-chat-item.active:hover {
    background: rgba(29, 78, 216, 0.15) !important;
}

/* ===== NEW: Wrapper for scrollable nav items ===== */
.sidebar-nav-scrollable {
    padding: 1px 7px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0; /* Don't compress */
}
/* Hide the expanded (Bootstrap) dropdown when sidebar is collapsed */
.sidebar:not(.expanded) #profileDropdownExpanded.show {
    display: none !important;
}
/* Hide the expanded (Bootstrap) dropdown when sidebar is collapsed */
.sidebar:not(.expanded) .chat-list {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════
   DROPDOWN VISIBILITY CONTROL
   ═══════════════════════════════════════════════════════════ */

/* Hide all dropdown menus by default */
.dropdown-menu {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Only show when Bootstrap adds .show class */
.dropdown-menu.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Profile dropdown - collapsed sidebar */
.profile-dropdown-collapsed:not(.show) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.profile-dropdown-collapsed.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ═══════════════════════════════════════════════════════════
   DROPDOWN POSITIONING & POPPER OVERRIDES
   ═══════════════════════════════════════════════════════════ */

/* Override Popper's inline transforms for ALL dropdowns */
#profileDropdownExpanded,
.profile-dropdown-collapsed,
.chat-menu-wrapper .dropdown-menu {
    transform: none !important;
    inset: unset !important;
}

/* Chat menu wrapper positioning */
.chat-menu-wrapper {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
}

.chat-item:hover .chat-menu-wrapper,
.chat-menu-wrapper.show {
    opacity: 1;
}


/* Chat menu dropdown - right aligned, below button */
.chat-menu-wrapper .dropdown-menu {
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
    top: 100% !important;
    bottom: auto !important;
    margin-top: 4px !important;
    margin-bottom: 0 !important;
    z-index: 1250 !important;
}

/* Profile dropdown - expanded sidebar (above profile button) */
#profileDropdownExpanded {
    position: absolute !important;
    bottom: 58px !important;
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    width: calc(100% - 16px) !important;
    margin: 0 !important;
    z-index: 10000 !important;
}

/* Profile dropdown - collapsed sidebar (to the right of profile) */
.profile-dropdown-collapsed {
    position: fixed !important;
    left: 68px !important;
    bottom: 70px !important;
    top: auto !important;
    min-width: 180px !important;
    max-width: 180px !important;
    z-index: 10000 !important;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR BOTTOM - NO EXTRA SPACE
   ═══════════════════════════════════════════════════════════ */

.sidebar-bottom {
    position: relative;
    margin-top: auto;
    background: var(--sidebar-bg);
    padding: 0 !important;
}

/* .user-profile {
    margin: 0 !important;
} */

/* Hide expanded dropdown when sidebar is collapsed */
.sidebar:not(.expanded) #profileDropdownExpanded.show {
    display: none !important;
}
/* Project chats use same .chat-item class, just adjust padding */

/* When opening above (not enough space below) */
.chat-menu-wrapper.dropup .dropdown-menu {
    top: auto !important;
    bottom: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 4px !important;
}

/* Ensure dropdown is above everything */
.project-chats-list .chat-menu-wrapper .dropdown-menu,
.chat-list .chat-menu-wrapper .dropdown-menu {
    z-index: 1300 !important;
}

/* ============================================================================
   Rename Chat Modal
   ============================================================================ */

#renameChatInput {
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    width: 100%;
    background: transparent;
    border: 1px solid #e5e7eb !important;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

#renameChatInput:focus {
    border: 1px solid rgba(27, 145, 248, 0.5) !important;
    box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05);
    color: #1a1a1a;
}

.modal-description strong {
    color: #111827;
    font-weight: 600;
}

/* Add to your sidebar CSS file */
.login-section {
    width: 100%;
    padding: 4px 8px;
}

.login-section .user-profile {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    box-sizing: border-box;
}

.login-section .user-profile:hover {
    background: var(--hover-bg, #F3F7FC);
    color: inherit;
    text-decoration: none;
}

/* Collapsed sidebar: center the icon */
.sidebar:not(.expanded) .login-section {
    padding: 4px 0;
    display: flex;
    justify-content: center;
}

.sidebar:not(.expanded) .login-section .user-profile {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
}

.sidebar:not(.expanded) .login-section .user-info {
    display: none;
}


/* Desktop: show desktop icon, hide mobile */
.shuttle-icon-mobile {
    display: none;
}

.shuttle-icon-desktop {
    display: block;
}

/* Mobile: show mobile icon, hide desktop */
@media (max-width: 768px) {
    .shuttle-icon-desktop {
        display: none;
    }

    .shuttle-icon-mobile {
        display: block;
    }
}
