/* Chat-specific styles */

/* Chat Main Content */
.chat-main {
    padding: 0;
    background-color: #fff;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Chat List */
.chat-list {
    background-color: #fff;
}

/* Chat Item */
.chat-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
    width: 100%;
    box-sizing: border-box;
}

.chat-item:hover {
    background-color: #f8f9fa;
}

.chat-item:active {
    background-color: #e9ecef;
}

/* Chat Avatar */
.chat-avatar {
    margin-right: 12px;
    flex-shrink: 0;
}

.avatar-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9ecef;
    transition: border-color 0.2s ease;
}

.chat-item:hover .avatar-img {
    border-color: #e91e63;
}

/* Chat Content */
.chat-content {
    flex: 1;
    min-width: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

/* Prevent conversation.css fixed header styles from breaking chat list rows */
.chat-list .chat-header {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    width: auto;
    z-index: auto;
    padding: 0;
    border-bottom: none;
    background: transparent;
    margin-bottom: 4px;
}

.chat-name {
    font-size: 16px;
    font-weight: 600;
    color: #000;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 12px;
    color: #6c757d;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Chat Preview */
.chat-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-message {
    font-size: 14px;
    color: #6c757d;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Unread Badge */
.unread-badge {
    background-color: #e91e63;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    flex-shrink: 0;
}

/* RTL support */
[dir="rtl"] .chat-avatar {
    margin-right: 0;
    margin-left: 12px;
}

[dir="rtl"] .chat-time {
    margin-left: 0;
    margin-right: 8px;
}

[dir="rtl"] .unread-badge {
    margin-left: 0;
    margin-right: 8px;
}

/* Chat list (reference layout): row meta + online dot + unread pill */
.chat-list-page {
    padding: 0 0 12px;
}

.chat-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    margin-right: 12px;
}

[dir="rtl"] .chat-avatar-wrap {
    margin-right: 0;
    margin-left: 12px;
}

.chat-avatar-wrap .chat-avatar {
    margin: 0;
}

.chat-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
    z-index: 2;
}

[dir="rtl"] .chat-online-dot {
    right: auto;
    left: 2px;
}

.chat-row-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.chat-row-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

[dir="rtl"] .chat-row-meta {
    align-items: flex-start;
}

.chat-unread-pill {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ec407a, #e91e63);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 22px;
    text-align: center;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.25);
}

/* Chat Divider */
.chat-divider {
    height: 1px;
    background-color: #e9ecef;
    margin: 0 20px;
}

/* Chat Item States */
.chat-item.unread {
    background-color: #f8f9fa;
}

.chat-item.unread .chat-name {
    font-weight: 700;
}

.chat-item.unread .chat-message {
    color: #000;
    font-weight: 500;
}

/* Empty State */
.chat-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.chat-empty i {
    font-size: 48px;
    color: #dee2e6;
    margin-bottom: 16px;
}

.chat-empty h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #000;
}

.chat-empty p {
    font-size: 14px;
    margin: 0;
}

/* Search Bar (if needed) */
.chat-search {
    padding: 16px 20px;
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    background-color: #f8f9fa;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #e91e63;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.search-input::placeholder {
    color: #6c757d;
}

/* Chat Item Animation */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.chat-item {
    animation: slideInRight 0.3s ease-out;
}

.chat-item:nth-child(2) {
    animation-delay: 0.1s;
}

.chat-item:nth-child(4) {
    animation-delay: 0.2s;
}

/* Responsive Design */
@media (max-width: 480px) {
    .chat-main {
        width: 100%;
        overflow-x: hidden;
    }
    
    .chat-item {
        padding: 14px 16px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .avatar-img {
        width: 45px;
        height: 45px;
    }
    
    .chat-name {
        font-size: 15px;
    }
    
    .chat-message {
        font-size: 13px;
    }
    
    .chat-time {
        font-size: 11px;
    }
    
    .unread-badge {
        font-size: 10px;
        padding: 3px 6px;
        min-width: 18px;
        height: 18px;
    }
}

/* Touch Feedback */
@media (hover: none) and (pointer: coarse) {
    .chat-item:active {
        background-color: #e9ecef;
        transform: scale(0.98);
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .chat-main {
        background-color: #1a1a1a;
    }
    
    .chat-item {
        border-bottom-color: #333;
    }
    
    .chat-item:hover {
        background-color: #2a2a2a;
    }
    
    .chat-name {
        color: #fff;
    }
    
    .chat-message {
        color: #ccc;
    }
    
    .chat-time {
        color: #999;
    }
    
    .avatar-img {
        border-color: #333;
    }
    
    .chat-divider {
        background-color: #333;
    }
}
