.sidebar {
    width: 280px;
    max-width: 280px;
    background: #1e1e1e;
    color: #e5e5e5;
    transition: transform 0.3s ease-in-out;
    transform: translateX(-100%);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    border-right: 1px solid #333;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 40;
}

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

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 26px;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: -0.3px;
    padding: 8px 0;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    flex-shrink: 0;
}

.new-chat-btn {
    width: 100%;
    padding: 14px 18px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.new-chat-btn:hover {
    background: linear-gradient(135deg, #5856eb, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.new-chat-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.conversation-section {
    padding: 0 16px;
    margin-top: 20px;
}

.section-title {
    font-size: 12px;
    font-weight: 500;
    color: #888;
    margin-bottom: 8px;
    padding-left: 4px;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 24px;
}

.conversation-item {
    display: block;
    padding: 12px 12px;
    color: #d1d5db;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.conversation-item:hover {
    background: #2a2a2a;
}

.conversation-item.active {
    background: #2a2a2a;
    color: #ffffff;
}

.conversation-title {
    font-weight: 400;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.conversation-date {
    font-size: 12px;
    color: #888;
    font-weight: 400;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 12px;
    border-top: 1px solid #333;
    background: #1e1e1e;
    flex-shrink: 0;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: #d1d5db;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.footer-item:hover {
    background: #2a2a2a;
}

.footer-icon {
    width: 16px;
    height: 16px;
    opacity: 0.8;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.new-badge {
    background: #10b981;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: auto;
}

/* New Arrow Toggle Button */
.sidebar-arrow-toggle {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 50;
    width: 32px;
    height: 56px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.85), rgba(139, 92, 246, 0.85));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-left: none;
    border-radius: 0 16px 16px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    backdrop-filter: blur(20px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 16px rgba(99, 102, 241, 0.15);
    overflow: hidden;
}

.sidebar-arrow-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent);
    border-radius: 0 16px 16px 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar-arrow-toggle:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 0.95));
    border-color: rgba(99, 102, 241, 0.4);
    width: 36px;
    height: 60px;
    box-shadow: 3px 0 20px rgba(99, 102, 241, 0.25);
    transform: translateY(-50%) translateX(2px);
}

.sidebar-arrow-toggle:hover::before {
    opacity: 1;
}

.sidebar-arrow-toggle.sidebar-open {
    left: 280px;
    transform: translateY(-50%) translateX(-100%);
}

.sidebar-arrow-toggle svg {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 16px;
    height: 16px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.sidebar-arrow-toggle.sidebar-open svg {
    transform: rotate(180deg);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 30;
    display: none;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.visible {
    display: block;
}

#conversation-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 8px;
}

/* Custom scrollbar */
#conversation-content::-webkit-scrollbar {
    width: 4px;
}

#conversation-content::-webkit-scrollbar-track {
    background: transparent;
}

#conversation-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

#conversation-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .sidebar {
        width: 85%;
        max-width: 320px;
    }

    .sidebar-header {
        padding: 20px 16px 12px;
    }

    .conversation-section {
        padding: 0 16px;
    }

    .sidebar-footer {
        padding: 16px;
    }

    .sidebar-arrow-toggle.sidebar-open {
        left: 85%;
    }
}

/* Animation improvements */
.sidebar-arrow-toggle,
.sidebar {
    will-change: transform;
}

/* Ensure smooth transitions */
* {
    -webkit-tap-highlight-color: transparent;
}