.chat-page {
    padding: 0;
    height: calc(100vh - 72px);
    background: var(--bg-secondary);
}

.chat-page .container {
    max-width: 100%;
    padding: 0;
    height: 100%;
}

.chat-container {
    display: grid;
    grid-template-columns: 360px 1fr;
    height: 100%;
    background: var(--bg-primary);
}

.conversations-sidebar {
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.btn-new-chat {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-new-chat:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.search-conversations {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-conversations input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    background: var(--bg-secondary);
}

.search-conversations input:focus {
    border-color: var(--primary-color);
    background: white;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.conversation-item:hover {
    background: var(--bg-secondary);
}

.conversation-item.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--primary-color);
}

.conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.conversation-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.conversation-time {
    font-size: 12px;
    color: var(--text-light);
}

.conversation-preview {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: var(--primary-color);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-secondary);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.chat-status {
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

.empty-chat-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-chat h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.message-group {
    display: flex;
    gap: 12px;
    max-width: 70%;
}

.message-group.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    word-wrap: break-word;
}

.message-group.sent .message-bubble {
    background: var(--primary-color);
    color: white;
}

.message-time {
    font-size: 11px;
    color: var(--text-light);
    padding: 0 8px;
}

.message-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.message-card:hover {
    box-shadow: var(--shadow-sm);
}

.card-product {
    display: flex;
    gap: 12px;
}

.card-product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.card-product-info {
    flex: 1;
}

.card-product-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.card-product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.message-input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.message-input-actions {
    display: flex;
    gap: 4px;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 120px;
    min-height: 40px;
}

#messageInput:focus {
    border-color: var(--primary-color);
}

.btn-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

@media (max-width: 1024px) {
    .chat-container {
        grid-template-columns: 300px 1fr;
    }
}

@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr;
    }
    
    .conversations-sidebar {
        display: none;
    }
    
    .conversations-sidebar.mobile-visible {
        display: flex;
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 80%;
        z-index: 100;
        box-shadow: var(--shadow-lg);
    }
    
    .message-group {
        max-width: 85%;
    }
}
