/* ========================================
   CHAT STYLES
   ======================================== */

.chat-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    min-height: 500px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin: 20px 0;
}

/* Sidebar */
.chat-sidebar {
    background: var(--smoke);
    border-right: 1px solid var(--smoke-dark);
    padding: 15px;
    overflow-y: auto;
    max-height: 600px;
}

.chat-sidebar h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.chat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-radius: var(--radius);
    background: white;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-dark);
}

.chat-item:hover {
    background: var(--primary-light);
}

.chat-item.active {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.chat-item-info {
    flex: 1;
}

.chat-item-info strong {
    display: block;
    font-size: 14px;
}

.chat-item-info small {
    color: var(--text-light);
    font-size: 12px;
}

.chat-item-info p {
    color: var(--text-light);
    font-size: 12px;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.chat-item .badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
}

/* Main Chat Area */
.chat-main {
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--smoke);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.chat-header h4 {
    margin: 0;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
}

.message {
    margin-bottom: 15px;
    max-width: 70%;
}

.message.sent {
    margin-left: auto;
}

.message.received {
    margin-right: auto;
}

.message-content {
    padding: 12px 16px;
    border-radius: var(--radius);
    word-wrap: break-word;
}

.message.sent .message-content {
    background: var(--primary);
    color: white;
}

.message.received .message-content {
    background: white;
    border: 1px solid var(--smoke-dark);
}

.message-meta {
    margin-top: 5px;
    font-size: 11px;
    opacity: 0.7;
}

.message.sent .message-meta {
    color: rgba(255, 255, 255, 0.8);
}

.message.received .message-meta {
    color: var(--text-light);
}

.message-meta .sender {
    margin-right: 10px;
}

/* Chat Input */
.chat-input {
    padding: 15px 20px;
    border-top: 1px solid var(--smoke);
    background: white;
}

.chat-input form {
    display: flex;
    gap: 10px;
}

.chat-input input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
}

.chat-input input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    padding: 40px;
}

.chat-empty h3 {
    margin-bottom: 10px;
}

/* No data */
.no-data {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    
    .chat-sidebar {
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--smoke-dark);
    }
    
    .chat-main {
        height: 500px;
    }
}

@media (max-width: 480px) {
    .chat-main {
        height: 400px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .chat-input form {
        flex-direction: column;
    }
}