/* ===== MESSAGES STYLES ===== */

.messages-section {
    padding: 30px 0 60px;
}

.messages-container {
    display: flex;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    height: calc(100vh - var(--header-height) - 180px);
    min-height: 600px;
}

/* Conversations Sidebar */
.conversations-sidebar {
    width: 320px;
    border-right: 1px solid var(--bg-dark);
    display: flex;
    flex-direction: column;
    background-color: var(--bg-light);
}

.conversations-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--bg-dark);
}

.conversations-header h2 {
    font-size: 1.3rem;
    color: var(--text-dark);
}

.conversations-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-medium);
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background-color: var(--bg-dark);
    color: var(--text-dark);
}

.search-bar {
    padding: 10px 15px;
    border-bottom: 1px solid var(--bg-dark);
}

.search-input {
    position: relative;
}

.search-input i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.search-input input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid var(--bg-dark);
    border-radius: 20px;
    font-size: 0.95rem;
}

.search-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.conversations-filter {
    display: flex;
    padding: 10px 15px;
    border-bottom: 1px solid var(--bg-dark);
    gap: 10px;
}

.filter-btn {
    background: none;
    border: none;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-medium);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover, .filter-btn.active {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--bg-dark);
}

.conversation-item:hover {
    background-color: rgba(0,0,0,0.02);
}

.conversation-item.active {
    background-color: var(--primary-light);
}

.conversation-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    margin-right: 15px;
    flex-shrink: 0;
}

.conversation-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.status-indicator.online {
    background-color: #4caf50;
}

.status-indicator.offline {
    background-color: var(--text-light);
}

.status-indicator.away {
    background-color: #ff9800;
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.conversation-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 0.8rem;
    color: var(--text-light);
    flex-shrink: 0;
}

.conversation-message p {
    font-size: 0.9rem;
    color: var(--text-medium);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item.unread .conversation-message p {
    font-weight: 600;
    color: var(--text-dark);
}

.conversation-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.unread-badge {
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.conversation-listing {
    font-size: 0.75rem;
    color: var(--text-light);
    background-color: var(--bg-dark);
    padding: 2px 8px;
    border-radius: 10px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat Main */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: white;
}

.chat-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--bg-dark);
}

.chat-user-info {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    margin-right: 10px;
}

.user-avatar.large {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
}

.user-status {
    font-size: 0.8rem;
    color: var(--text-light);
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.chat-listing-info {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--bg-dark);
}

.listing-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-right: 15px;
    flex-shrink: 0;
}

.listing-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.listing-details {
    flex: 1;
}

.listing-details h4 {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.listing-price {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f5f7f9;
}

.chat-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.chat-date-separator::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background-color: var(--bg-dark);
    z-index: 1;
}

.chat-date-separator span {
    background-color: #f5f7f9;
    padding: 0 15px;
    font-size: 0.8rem;
    color: var(--text-light);
    position: relative;
    z-index: 2;
}

.message-item {
    display: flex;
    margin-bottom: 20px;
}

.message-item.sent {
    justify-content: flex-end;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 10px;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    max-width: 70%;
}

.message-bubble {
    padding: 12px 15px;
    border-radius: 18px;
    position: relative;
}

.message-item.received .message-bubble {
    background-color: white;
    border-top-left-radius: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-item.sent .message-bubble {
    background-color: var(--primary-light);
    border-top-right-radius: 0;
}

.message-bubble p {
    margin: 0;
    color: var(--text-dark);
    font-size: 0.95rem;
    line-height: 1.4;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 5px;
    display: flex;
    align-items: center;
}

.message-item.sent .message-time {
    justify-content: flex-end;
}

.message-time i {
    margin-left: 5px;
    font-size: 0.7rem;
    color: var(--primary-color);
}

.message-file {
    display: flex;
    align-items: center;
    background-color: var(--bg-light);
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

.message-file i {
    font-size: 1.5rem;
    color: #e53935;
    margin-right: 10px;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
}

.file-download {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.file-download:hover {
    background-color: var(--primary-color);
    color: white;
}

.system-message {
    text-align: center;
    margin: 20px 0;
}

.system-message span {
    background-color: rgba(0,0,0,0.05);
    color: var(--text-medium);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.chat-input {
    padding: 15px;
    border-top: 1px solid var(--bg-dark);
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.input-actions {
    display: flex;
    gap: 5px;
}

.input-field {
    flex: 1;
    position: relative;
}

.input-field textarea {
    width: 100%;
    height: 44px;
    max-height: 100px;
    resize: none;
    border: 1px solid var(--bg-dark);
    border-radius: 22px;
    padding: 12px 15px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
}

.input-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background-color: var(--primary-dark);
}

/* User Sidebar */
.user-sidebar {
    width: 300px;
    border-left: 1px solid var(--bg-dark);
    background-color: var(--bg-light);
    overflow-y: auto;
}

.user-profile {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--bg-dark);
}

.user-fullname {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.user-meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
}

.user-meta-item {
    font-size: 0.85rem;
    color: var(--text-medium);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-meta-item i {
    margin-right: 8px;
    color: var(--primary-color);
}

.user-rating {
    margin-bottom: 15px;
}

.rating-stars {
    color: #ffc107;
    margin-bottom: 5px;
}

.rating-value {
    font-weight: 600;
    margin-right: 5px;
}

.rating-count {
    font-size: 0.85rem;
    color: var(--text-medium);
}

.btn-block {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-block i {
    margin-right: 5px;
}

.conversation-actions, .shared-files, .shared-media {
    padding: 20px;
    border-bottom: 1px solid var(--bg-dark);
}

.conversation-actions h4, .shared-files h4, .shared-media h4 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.actions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-link {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    color: var(--text-medium);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px 0;
    width: 100%;
    text-align: left;
}

.action-link:hover {
    color: var(--primary-color);
}

.action-link.warning:hover {
    color: var(--danger);
}

.action-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.file-item i {
    font-size: 1.2rem;
    margin-right: 10px;
    color: #e53935;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.media-grid.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    background-color: white;
    border-radius: var(--border-radius);
}

.empty-message {
    text-align: center;
    color: var(--text-light);
}

.empty-message i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.empty-message p {
    font-size: 0.9rem;
}

/* Mobile Chat Navigation */
.mobile-chat-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-top: 1px solid var(--bg-dark);
    padding: 10px;
    z-index: 100;
}

.mobile-chat-nav .nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-medium);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-chat-nav .nav-btn i {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.mobile-chat-nav .nav-btn.active {
    color: var(--primary-color);
}

/* Responsive Styles */
@media (max-width: 1100px) {
    .user-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .messages-container {
        height: calc(100vh - var(--header-height) - 150px);
        min-height: 500px;
    }
    
    .conversations-sidebar {
        width: 100%;
        display: flex;
    }
    
    .chat-main {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 66px;
        display: none;
        z-index: 100;
    }
    
    .user-sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 66px;
        width: 100%;
        display: none;
        z-index: 100;
    }
    
    .mobile-chat-nav {
        display: flex;
    }
    
    .mobile-chat-nav .nav-btn.active[data-target="conversations-sidebar"] ~ .conversations-sidebar,
    .mobile-chat-nav .nav-btn.active[data-target="chat-main"] ~ .chat-main,
    .mobile-chat-nav .nav-btn.active[data-target="user-sidebar"] ~ .user-sidebar {
        display: flex;
    }
}

@media (max-width: 576px) {
    .messages-section {
        padding: 15px 0;
    }
    
    .messages-container {
        height: calc(100vh - var(--header-height) - 100px);
        min-height: 400px;
    }
    
    .chat-header, .conversations-header {
        padding: 10px;
    }
    
    .listing-thumbnail {
        width: 50px;
        height: 50px;
    }
    
    .action-btn {
        width: 32px;
        height: 32px;
    }
    
    .chat-messages {
        padding: 15px 10px;
    }
    
    .message-content {
        max-width: 85%;
    }
}