/**
 * Chat Thread History Menu Styles
 */

.chat-thread-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    width: 100%;
    background: var(--panel-bg, #1a1a1a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
}

.thread-menu-content {
    display: flex;
    flex-direction: column;
    /* Max-height set dynamically by JavaScript */
}

.thread-menu-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 20px;
    background: none;
    border: none;
    color: var(--text-color, #e0e0e0);
    font-size: 16px;
    font-family: inherit;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
}

.new-chat-item:hover {
    background-color: var(--hover-bg, rgba(255, 255, 255, 0.05));
}

.thread-menu-item:active {
    background-color: var(--active-bg, rgba(255, 255, 255, 0.1));
}

.thread-menu-item i {
    flex-shrink: 0;
    font-size: 16px;
    opacity: 0.6;
}

.new-chat-item {
    font-weight: 600;
    font-size: 17px;
}

.new-chat-item i {
    color: var(--primary-color, #4a9eff);
    opacity: 1;
}

.thread-menu-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 8px 24px;
}

.thread-menu-history {
    overflow-y: auto;
    /* Max-height set dynamically by JavaScript */
    padding: 12px 24px;
    /* Firefox scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Webkit scrollbar styling (Chrome, Safari, Edge) */
.thread-menu-history::-webkit-scrollbar {
    width: 6px;
    background: transparent;
}

.thread-menu-history::-webkit-scrollbar-track {
    background: transparent;
}

.thread-menu-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.thread-menu-history::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.thread-history-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin-bottom: 10px;
    justify-content: center;
}

.thread-history-item:last-child {
    margin-bottom: 0;
}

.thread-history-item:hover {
    background-color: rgba(74, 158, 255, 0.1);
    border-color: rgba(74, 158, 255, 0.3);
    transform: translateY(-1px);
}

.thread-history-item .thread-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

.show-more-item {
    background: rgba(74, 158, 255, 0.08);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 8px;
    margin-top: 10px;
    color: var(--primary-color, #4a9eff);
    font-weight: 500;
    justify-content: center;
}

.show-more-item:hover {
    background: rgba(74, 158, 255, 0.15);
    border-color: rgba(74, 158, 255, 0.4);
    transform: translateY(-1px);
}

.show-more-item i {
    opacity: 0.8;
}

.thread-menu-loading,
.thread-menu-empty,
.thread-menu-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 20px;
    color: var(--text-muted, #888);
    font-size: 15px;
}

.thread-menu-loading i,
.thread-menu-empty i,
.thread-menu-error i {
    opacity: 0.6;
}

.thread-menu-error {
    color: var(--error-color, #ff6b6b);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .thread-menu-item {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .new-chat-item {
        font-size: 16px;
    }
}

/* Animation for menu appearance */
@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-thread-menu[style*="display: block"] {
    animation: menuFadeIn 0.15s ease-out;
}

