.chat-history-container {
    position: fixed;
    left: 280px; 
    top: 0;
    height: 100dvh; 
    background-color: #ffffff;
    border-left: 1px solid #f0f0f0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    z-index: 90; 
    display: flex;
    flex-direction: column;
    border-top-right-radius: 20px; 
    padding-bottom: 20px;
    width: 0; 
    opacity: 0;
    visibility: hidden;
    overflow: hidden; 

    transition: left 0.3s ease-in-out, 
                width 0.3s ease-in-out, 
                opacity 0.3s ease-in-out,
                visibility 0.3s ease-in-out;
 
}

html.sidebar-is-minimized-on-load .chat-history-container {
    /* Match sidebar's MINIMIZED width */
    left: 80px; 
}

.chat-history-container.is-open {
    width: 325px; 
    opacity: 1;
    visibility: visible;
}

.ch-inner-wrapper {
    min-width: 325px; 
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header Styles */
.ch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 10px 20px;
}

.ch-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111;
    margin: 0;
}

.ch-new-btn {
    background-color: #FD8559; 
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 12px;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.ch-new-btn:hover{
    color: white;
}

/* Search Styles */
.ch-search-wrapper {
    padding: 10px 20px;
}

.ch-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.ch-search-input {
    width: 100%;
    padding: 10px 10px 10px 35px;
    border-radius: 12px;
    border: 1px solid #D9EEF3;
    outline: none;
    font-size: 0.9rem;
    color: #555;
}

.ch-search-input::placeholder {
    color: #ccc;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #D9EEF3;
    width: 16px;
}

/* List Styles */
.ch-list-container {
    flex: 1;
    overflow-y: auto; 
    padding: 10px 20px;
    min-height: 0;
    max-height: 630px;
    margin-bottom: 90px;
}

.ch-list-container::-webkit-scrollbar {
    width: 4px;
}
.ch-list-container::-webkit-scrollbar-thumb {
    background: #eee;
    border-radius: 4px;
}

.ch-group {
    margin-bottom: 20px;
}

.ch-group-label {
    font-size: 0.875rem;
    color: #889596;
    margin-bottom: 10px;
}

.ch-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ch-item {
    margin-bottom: 5px;
}

.ch-link {
    display: block;
    text-decoration: none;
    color: #425759;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Active/Hover States */
.ch-item.active .ch-link {
    background-color: #f7f7f7;
    color: #132D2F;
    font-weight: 500;
}

.ch-item:hover .ch-link {
    background-color: #fafafa;
    color: #132D2F;
}

#btn-close-chat-history.btn-icon-only {
    background: #FFFFFF;
    border: 1px solid #D9EEF3;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* skeleton loader items */
.chat-history-skeleton-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    margin-bottom: 10px;
    animation: pulse 1.5s ease-in-out infinite;
}

.chat-history-skeleton-title {
    width: 75%;
    height: 16px;
    background: linear-gradient(90deg, #e9ecef 25%, #dee2e6 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    
    transform: none !important; 
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.mobile-only { display: none; }
.desktop-only { display: flex; }

@media screen and (max-width: 768px) {
    
    .mobile-only { display: flex; }
    .desktop-only { display: none; }

    .chat-history-container {
        position: fixed; 
        top: 0;
        left: 0 !important;; 
        height: 100dvh;
        z-index: 1000; 
        border-left: none;
        width: 0; 
    }

    .chat-history-container.is-open {
        width: 325px; 
        max-width: 85vw; 
        box-shadow: 10px 0 30px rgba(0,0,0,0.2);
    }

    .ch-list-container{
        margin-bottom: 9rem;
    }

    .ch-header {
        padding: 20px;
    }

    .ch-mobile-footer {
        /* display: flex;
        justify-content: flex-end;
        padding: 10px 20px 0px; */
        position: absolute;
        bottom: calc(30px + env(safe-area-inset-bottom));
        right: 1rem;
        z-index: 20;
        width: max-content;
        margin-bottom: 3rem;
    }
    
}