:root {
    --primary-color: #2196F3;
    --light-primary: #E3F2FD;
    --dark-primary: #1976D2;
    --accent-color: #FF5722;
    --text-primary: #212121;
    --text-secondary: #757575;
    --divider-color: #BDBDBD;
    --background-light: #f5f5f5;
    --message-user: #E3F2FD;
    --message-other: #FFFFFF;
    --online-status: #4CAF50;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.chat-container {
    display: flex;
    height: calc(100vh - 60px);
    width: 100%;
    background-color: #fff;
    overflow: hidden;
}

/* Sidebar Styles */
.chat-sidebar {
    width: 600px;
    background-color: var(--background-light);
    border-right: 1px solid var(--divider-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    padding: 20px;
    background-color: var(--primary-color);
    color: white;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 15px;
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar a {
    display: contents;
}

.user-info h3 {
    font-size: 16px;
    font-weight: 600;
}

.user-info p {
    font-size: 12px;
    opacity: 0.8;
}

.search-box {
    padding: 15px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: none;
    border-radius: 20px;
    background-color: white;
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.search-box i {
    position: absolute;
    left: 30px;
    top: 25px;
    color: var(--text-secondary);
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.conversation {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--divider-color);
    cursor: pointer;
    transition: background-color 0.2s;
    min-height: 60px;
}

.conversation:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.conversation.active {
    background-color: #E3F2FD;
}

.conversation-info {
    flex: 1;
    margin-right: 10px;
    min-width: 0;
    overflow: hidden;
}

.conversation-info h4 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-info p {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.conversation-time {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 40px;
    text-align: right;
}

/* Main Chat Area Styles */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - 600px);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #fff;
    border-bottom: 1px solid var(--divider-color);
}

.chat-contact {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.contact-info {
    min-width: 0;
    overflow: hidden;
    flex: 1;
}

.contact-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-info p {
    font-size: 12px;
    color: var(--online-status);
}

.contact-info p::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--online-status);
    margin-right: 5px;
}

.chat-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-actions i {
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.chat-actions i:hover {
    color: var(--primary-color);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #ECE5DD;
    display: flex;
    flex-direction: column;
}

.message-date {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin: 10px 0;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    padding: 5px 10px;
    align-self: center;
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-end;
    max-width: 80%;
}

.chat-message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.chat-message.other {
    margin-right: auto;
}

.chat-message .message {
    padding: 10px 15px;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-message.user .message {
    background-color: var(--message-user);
    border-top-right-radius: 5px;
    margin-right: 5px;
}

.chat-message.other .message {
    background-color: var(--message-other);
    border-top-left-radius: 5px;
    margin-left: 5px;
}

.message p {
    color: var(--text-primary);
    font-size: 15px;
    margin-bottom: 5px;
    text-align: left;
}

.message .message-time {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    text-align: right;
}

/* Input Area */
.chat-input {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #F5F5F5;
    border-top: 1px solid var(--divider-color);
    position: relative;
}

.input-actions {
    display: flex;
    margin-right: 15px;
}

.input-actions i {
    font-size: 20px;
    color: var(--text-secondary);
    margin-right: 15px;
    cursor: pointer;
    transition: color 0.2s;
}

.input-actions i:hover {
    color: var(--primary-color);
}

#message-input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 20px;
    background-color: white;
    font-size: 15px;
    color: var(--text-primary);
    resize: none;
    max-height: 100px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    outline: none;
}

#send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    margin-left: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

#send-button:hover {
    background-color: var(--dark-primary);
}

/* Login input area for non-authenticated users */
.chat-input-login {
    justify-content: center;
}

.login-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.login-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.login-btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.login-btn-primary:hover {
    background-color: var(--dark-primary);
    color: white;
}

.login-btn-secondary {
    background-color: var(--online-status);
    color: white;
}

.login-btn-secondary:hover {
    background-color: #388E3C;
    color: white;
}

.login-separator {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.login-message {
    color: var(--text-secondary);
    font-size: 14px;
    font-style: italic;
}

/* Emoji picker styles */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 15px;
    background-color: white;
    border: 1px solid var(--divider-color);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 10px;
    margin-bottom: 5px;
    z-index: 1000;
}

.emoji-list {
    display: flex;
    gap: 8px;
}

.emoji-item {
    font-size: 20px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
}

.emoji-item:hover {
    background-color: var(--light-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
    }
    
    .chat-sidebar {
        width: 100%;
        height: 300px;
    }
    
    .chat-main {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .conversation-info p {
        max-width: 120px;
    }
    
    .chat-header {
        padding: 10px;
    }
    
    .chat-actions i {
        margin-left: 10px;
    }
    
    .input-actions {
        margin-right: 5px;
    }
    
    .input-actions i {
        margin-right: 5px;
    }
    
    .login-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .login-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

.status-tag {
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
}

.status-tag.confirmed {
    background-color: #E8F5E8;
    color: #2E7D32;
}

.status-tag.denied {
    background-color: #FFEBEE;
    color: #C62828;
}

.status-tag.big {
    font-size: 16px;
}

/* Trade validation buttons */
.validate-trade-btn, .cancel-trade-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.validate-trade-btn {
    background-color: var(--online-status);
    color: white;
}

.validate-trade-btn:hover {
    background-color: #388E3C;
}

.cancel-trade-btn {
    background-color: #9E9E9E;
    color: white;
}

.cancel-trade-btn:hover {
    background-color: #D32F2F;
}