/* css/private-chat.css */

/* =================================== */
/* --- GENERAL & DESKTOP STYLES --- */
/* =================================== */

#app-container {
    height: 75vh;
    max-height: 800px;
    border: 1px solid var(--card-border);
    border-radius: 0.375rem;
    position: relative;
    display: flex;
    overflow: hidden;
}

.chat-view-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- User List Column --- */
.user-list-container {
    flex: 0 0 250px;
    min-width: 250px;
    border-right: 12px solid var(--card-border);
    background-color: var(--section-alt-bg);
    transition: all 0.3s ease-in-out;
    display: flex;
    position: relative;
}

#user-list-inner-wrapper {
    width: 100%;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- THE HANDLE ICON (Desktop Positioning) --- */
.user-list-container::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -11px; /* Correct for DESKTOP view */
    transform: translateY(-50%);
    width: 10px;
    height: 24px;
    background-image:
        linear-gradient(var(--secondary-text-color), var(--secondary-text-color)),
        linear-gradient(var(--secondary-text-color), var(--secondary-text-color)),
        linear-gradient(var(--secondary-text-color), var(--secondary-text-color));
    background-repeat: no-repeat;
    background-size: 2px 20px;
    background-position: left center, center center, right center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}


/* --- THE DESKTOP COLLAPSED STATE --- */
#app-container.user-lists-collapsed-left .user-list-container {
    flex-basis: 0;
    min-width: 0;
    cursor: pointer; 
}
#app-container.user-lists-collapsed-left #user-list-inner-wrapper {
    min-width: 0;
}
#app-container.user-lists-collapsed-left .user-list-container:hover {
    border-right-color: var(--link-color);
}
#app-container.user-lists-collapsed-left .user-list-container::after {
    opacity: 1;
}
#app-container.user-lists-collapsed-left #toggle-user-lists-left-btn {
    transform: rotate(180deg);
}


/* --- CHAT LAYOUT & MESSAGES --- */
#chat-container { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; }
.chat-header, .chat-form { flex-shrink: 0; }
.chat-window { flex-grow: 1; overflow-y: auto; min-height: 0; }
.chat-message p { word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap; margin-bottom: 0; }


/* --- Other Component Styles (Unchanged) --- */
#user-list-inner-wrapper .current-user-display,
#user-list-inner-wrapper .user-list-item {
    white-space: nowrap;
}
#toggle-user-lists-left-btn { transition: transform 0.3s ease-in-out; }
.current-user-display { padding: 10px 15px; border-bottom: 1px solid var(--card-border); display: flex; justify-content: space-between; align-items: center; }
.user-lists { overflow-y: auto; flex-grow: 1; }
.user-category { padding: 10px; border-bottom: 1px solid var(--card-border); }
.user-category h6 { margin: 0 0 10px 5px; font-size: 0.9rem; text-transform: uppercase; color: var(--secondary-text-color); }
.user-list-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; cursor: pointer; border-radius: 0.25rem; }
.chat-placeholder { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; text-align: center; }


/* ================================= */
/* --- MOBILE SPECIFIC STYLES ---    */
/* ================================= */
@media (max-width: 991.98px) {
    #app-container { flex-direction: row !important; flex-wrap: nowrap; }

    .user-list-container {
        flex: 0 0 280px; 
        width: 280px;
        min-width: 280px;
        margin-left: -268px; /* 280px width - 12px border */
        transition: margin-left 0.3s ease-in-out;
        cursor: pointer;
    }
    
    /* --- THE FINAL MOBILE HANDLE FIX --- */
    .user-list-container::after {
        opacity: 1;
        /* Unset the desktop 'right' property */
        right: auto; 
        /* Position the handle's left edge to the parent's right edge */
        left: 100%; 
        /* Nudge the handle 1px into the border for centering */
        margin-left: 1px;
    }

    #app-container.user-list-open .user-list-container {
        margin-left: 0;
        box-shadow: 3px 0 15px rgba(0,0,0,0.2);
    }
    
    .chat-header h5 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 5px; }
}