﻿:root {
    /* Colors */
    --primary-color: #007bff;
    --success-color: #28a745;
    --offline-color: #ccc;
    --border-color: #e9ecef;
    --bg-light: #f5f6f8;
    --text-muted: #6c757d;
    /* Spacing and Sizes */
    --spacing-sm: 5px;
    --spacing-md: 10px;
    --spacing-lg: 15px;
    --avatar-size: 40px;
    /* Effects */
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Base Layout */
.messenger {
    display: flex;
    height: 100vh;
    background: var(--bg-light);
}

/* Sidebar */
.messenger-sidebar {
    width: 300px;
    background: #fff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.messenger-sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.messenger-sidebar-body {
    flex-grow: 1;
    padding: var(--spacing-md) 0;
    overflow-y: auto;
    max-height: calc(100vh - 60px);
}

/* Accordion */
.accordion-item {
    border: none;
}

.accordion-button {
    background: #f8f9fa;
    padding: 8px var(--spacing-lg);
    font-size: 14px;
}

    .accordion-button:not(.collapsed) {
        background: var(--border-color);
    }

.accordion-collapse {
    transition: height 0.3s ease;
}

.accordion-body {
    padding: var(--spacing-sm) var(--spacing-lg);
    max-height: 100px;
    overflow-y: auto;
}

/* Sidebar Links */
.messenger-link {
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    color: #333;
    cursor: pointer;
}

    .messenger-link:hover,
    .messenger-link.active {
        background: #f1f3f5;
    }

/* Common Media Styling */
.messenger-media,
.online-indicator {
    width: var(--avatar-size);
    height: var(--avatar-size);
    margin-right: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.online-indicator-small {
    width: 20px;
    height: 20px;
}

.messenger-media {
    background: var(--primary-color);
    color: #fff;
}

    .messenger-media img,
    .online-indicator .avatar {
        width: 75%;
        height: 75%;
        border-radius: 50%;
        object-fit: cover;
    }

.online-indicator {
    background: var(--offline-color);
    overflow: hidden;
}

    .online-indicator.online {
        background: var(--success-color);
    }

    .online-indicator .avatar {
        border: 2px solid #fff;
    }

    .messenger-media i,
    .online-indicator i {
        font-size: 20px;
        color: #fff;
    }

/* Content */
.messenger-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.messenger-content-header {
    padding: var(--spacing-md);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    margin-bottom: 0;
}

.messenger-content-body {
    position: relative;
    flex-grow: 1;
    padding: 0;
    overflow-y: hidden;
}

.messenger-content-footer {
    padding: var(--spacing-lg);
    background: #fff;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Chat Window */
#messagesList {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    padding: var(--spacing-md);
    box-sizing: border-box;
}

    #messagesList::-webkit-scrollbar {
        width: 8px;
    }

    #messagesList::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }

    #messagesList::-webkit-scrollbar-track {
        background: transparent;
    }

/* Chat Messages */
.widget-chat-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
    width: 100%;
}

    .widget-chat-item:not(.reply) {
        justify-content: flex-start;
    }

    .widget-chat-item.reply {
        justify-content: flex-end;
        flex-direction: row-reverse;
    }

        .widget-chat-item.reply .widget-chat-content {
            text-align: right;
        }

.widget-chat-content {
    max-width: 70%;
    padding: var(--spacing-md);
    border-radius: 8px;
    position: relative;
}

.widget-chat-item:not(.reply) .widget-chat-message {
    background: #f1f1f1;
}

.widget-chat-item.reply .widget-chat-message {
    background: var(--primary-color);
    color: #fff;
}

.widget-chat-name {
    font-weight: 500;
    font-size: 14px;
    color: #212529;
    margin-bottom: var(--spacing-sm);
}

.widget-chat-message {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--spacing-md);
    font-size: 14px;
    word-wrap: break-word;
    box-shadow: var(--shadow);
}

.widget-chat-status {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--spacing-sm);
}

.widget-chat-media {
    margin-right: var(--spacing-md);
}

.widget-chat-date {
    text-align: center;
    margin: var(--spacing-lg) 0;
    color: #666;
    font-size: 12px;
    position: relative;
}

    .widget-chat-date::before {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        top: 50%;
        height: 1px;
        background: var(--border-color);
        z-index: 0;
    }

    .widget-chat-date span {
        background: #e0e0e0;
        padding: var(--spacing-sm) var(--spacing-md);
        border-radius: 20px;
        position: relative;
        z-index: 1;
    }

/* Input Container */
.message-input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: var(--spacing-md);
    z-index: 10;
}

/* Miscellaneous */
.active-user-info,
.profile-indicator {
    display: flex;
    align-items: center;
}

.profile-indicator {
    margin-left: var(--spacing-md);
    font-weight: 500;
}

.list-group-flush {
    border: none;
}

.favorite-users-list,
.favorite-groups-list {
    overflow-y: auto;
}

.ps-35px {
    padding-left: 35px !important;
}

.avatar-sm {
    width: 24px;
    height: 24px;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-text {
    display: flex;
    align-items: center;
    justify-content: center;
}

.unread-badge {
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    padding: 0 6px;
}

.line-clamp {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-field {
    width: 100%;
    margin-top: 5px;
}

.edit-actions {
    margin-top: 5px;
}

.dropdown-menu .dropdown-item {
    padding: 0; /* Remove default padding from Bootstrap */
    width: 100%; /* Ensure full width */
}

    .dropdown-menu .dropdown-item a {
        display: flex; /* Already present with d-flex */
        align-items: center; /* Already present */
        width: 100%; /* Stretch to full width */
        padding: 8px 16px; /* Restore padding inside the <a> */
        text-decoration: none; /* Remove underline */
        color: inherit; /* Inherit color from Bootstrap */
    }

    .dropdown-menu .dropdown-item:hover {
        background-color: #f8f9fa; /* Bootstrap hover color */
    }