/* assets/css/chat-widget.css - საბოლოო, შესწორებული ვერსია */

#chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
}

.chat-widget-trigger {
    width: 60px;
    height: 60px;
    background: var(--primary-color, #b40000);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    position: relative;
}

.chat-widget-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.unread-count-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #dc3545;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.chat-widget-window {
    width: 350px;
    height: 450px;
    max-height: 80vh;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 0;
    right: 0;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.widget-header h5 {
    font-size: 1rem;
    font-weight: 600;
}

.widget-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.widget-conversations-list {
    overflow-y: auto;
    flex-grow: 1;
}

/* --- ★★★ START: დამატებული და შესწორებული სტილები ★★★ --- */

.widget-conversations-list .chat-list-item {
    display: flex; /* ეს ხაზი აიძულებს ელემენტებს, რომ გვერდიგვერდ დადგნენ */
    align-items: center;
    padding: 0.6rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.widget-conversations-list .chat-list-item:hover {
    background-color: #f1f3f5;
}

/* ვიჯეტისთვის ავატარი უფრო პატარა ზომის */
.widget-conversations-list .chat-avatar, 
.widget-messages-header .chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.widget-conversations-list .chat-list-item-info {
    flex-grow: 1;
    overflow: hidden;
}

.widget-conversations-list .chat-list-item-info h6 {
    margin-bottom: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    font-weight: 600;
}

.widget-conversations-list .chat-list-item-info p {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* --- ★★★ END: დამატებული და შესწორებული სტილები ★★★ --- */


.widget-messages-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    transform: translateX(100%);
}

.widget-messages-view.active {
    transform: translateX(0);
}

.widget-messages-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.widget-messages-header .btn-back {
    border: none;
    background: none;
    font-size: 1rem;
    margin-right: 0.75rem;
    color: #6c757d;
}

.widget-messages-header h6 {
    font-size: 0.9rem;
    font-weight: 600;
}

.widget-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f1f3f5;
    min-height: 0;
}

/* ვიჯეტის შეტყობინებების სტილები (აღებულია chat.css-დან) */
.widget-messages .message {
    display: flex;
    margin-bottom: 0.75rem;
    max-width: 80%;
}

.widget-messages .message-bubble {
    padding: 0.5rem 0.85rem;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.widget-messages .message.sent {
    margin-left: auto;
}
.widget-messages .message.sent .message-bubble {
    background: var(--primary-color, #b40000);
    color: white;
}

.widget-messages .message.received {
    margin-right: auto;
}
.widget-messages .message.received .message-bubble {
    background-color: #e9ecef;
    color: #212529;
}


.widget-input-area {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
}

.widget-input-area textarea {
    flex-grow: 1;
    border: none;
    resize: none;
    padding: 0.5rem;
    font-size: 0.9rem;
    background: transparent;
}

.widget-input-area textarea:focus {
    outline: none;
    box-shadow: none;
}

.widget-input-area button {
    border: none;
    background: none;
    color: var(--primary-color, #b40000);
    font-size: 1.2rem;
    padding: 0.5rem;
}