/* Sidebar Interactions CSS */
/* Modern History Popup Design */

.history-popup {
    position: fixed;
    background: var(--input-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 20px;
    /* Match user menu radius */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    /* Keep shadow distinct */
    width: 200px;
    max-height: 480px;
    z-index: 9999999 !important;
    overflow: hidden;
    display: none;
    opacity: 0;
    padding: 16px;
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
    transform: translateX(-5px);
    color: var(--text-primary, #fff);
    left: 75px;
}

.history-popup.visible {
    opacity: 1;
    transform: translateX(0);
}

.history-popup-title-bar {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin-bottom: 12px;
}

.history-popup-list {
    max-height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Scrollbar */
.history-popup-list::-webkit-scrollbar {
    width: 4px;
}

.history-popup-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-popup-list::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.2));
    border-radius: 2px;
}

.history-popup-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-faded, rgba(255, 255, 255, 0.5));
    margin: 8px 0 4px 8px;
    /* Indent slightly */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-popup-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    /* Match user menu */
    border-radius: 12px;
    /* Match user menu */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* Match user menu */
    text-decoration: none;
}

.history-popup-item:hover {
    background-color: var(--nav-active-bg, rgba(255, 255, 255, 0.1));
}

.history-popup-item-text {
    font-size: 13px;
    color: var(--text-secondary, #e0e0e0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.history-popup-item:hover .history-popup-item-text {
    color: var(--text-primary, #fff);
}

.history-popup-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.05));
}

.history-popup-see-all {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-faded, rgba(255, 255, 255, 0.6));
    cursor: pointer;
    transition: all 0.15s ease;
}

.history-popup-see-all:hover {
    background-color: var(--nav-active-bg, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #fff);
}

.history-popup-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-faded, rgba(255, 255, 255, 0.4));
    font-size: 13px;
}

/* Collapsed Search Button */
.collapsed-search-btn {
    display: none !important;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent !important;
    border: none;
    color: var(--text-secondary, #808080);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    margin: 12px auto 0 auto;
}

.collapsed-search-btn:hover {
    background-color: var(--nav-active-bg, rgba(255, 255, 255, 0.05)) !important;
    color: var(--text-primary, #fff);
}

.collapsed-search-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.sidebar.collapsed .collapsed-search-btn {
    display: flex !important;
}

/* Sidebar Skeleton Loader */
.history-skeleton-loader {
    padding: 12px;
}

.history-skeleton-item {
    display: flex;
    align-items: center;
    padding: 8px;
    gap: 10px;
    margin-bottom: 8px;
    animation: skeletonPulse 1.5s infinite ease-in-out;
    opacity: 0.6;
}

.history-skeleton-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.history-skeleton-text {
    height: 12px;
    flex: 1;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.history-skeleton-text.short {
    width: 60%;
}

@keyframes skeletonPulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 0.4;
    }
}