:root {
    --primary-color: #00a884;
    --bg-color: #d1d7db;
    --sidebar-bg: #ffffff;
    --chat-bg: #efeae2;
    --message-out: #d9fdd3;
    --message-in: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Sidebar */
.sidebar {
    width: 30%;
    min-width: 300px;
    border-right: 1px solid #e9edef;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
}

.sidebar-header {
    padding: 10px 16px;
    background: #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.sidebar-actions button,
.sidebar-actions a {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #54656f;
    cursor: pointer;
    margin-left: 15px;
    text-decoration: none;
}

.search-bar {
    padding: 8px 12px;
    background: white;
    border-bottom: 1px solid #f0f2f5;
}

.search-bar input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background: #f0f2f5;
    outline: none;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f2f5;
}

.chat-item:hover {
    background: #f5f6f6;
}

.chat-item.active {
    background: #f0f2f5;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
}

.chat-info {
    flex: 1;
}

.chat-name {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

.chat-name h4 {
    font-size: 1rem;
    font-weight: normal;
    color: #111b21;
}

.chat-time {
    font-size: 0.75rem;
    color: #667781;
}

.chat-preview {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #667781;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--chat-bg);
    position: relative;
}

.chat-header {
    padding: 10px 16px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    height: 60px;
    border-left: 1px solid #d1d7db;
}

.back-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #54656f;
    cursor: pointer;
    margin-right: 15px;
}

.user-details h3 {
    font-size: 1rem;
    font-weight: normal;
    color: #111b21;
}

.user-details span {
    font-size: 0.8rem;
    color: #667781;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-image: url('../images/chat-bg.png');
    /* Optional: Add a subtle pattern */
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.message.sent {
    align-self: flex-end;
    background: var(--message-out);
    border-top-right-radius: 0;
}

.message.received {
    align-self: flex-start;
    background: var(--message-in);
    border-top-left-radius: 0;
}

.msg-time {
    font-size: 0.7rem;
    color: #667781;
    float: right;
    margin-left: 10px;
    margin-top: 5px;
}

.msg-status {
    font-size: 0.7rem;
    margin-left: 3px;
}

.msg-status.seen {
    color: #53bdeb;
}

.input-area {
    padding: 10px 16px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-area input {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    outline: none;
}

.input-area button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #54656f;
    cursor: pointer;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #667781;
    text-align: center;
}

.welcome-screen i {
    font-size: 5rem;
    margin-bottom: 20px;
    color: #d1d7db;
}

.search-results {
    position: absolute;
    top: 110px;
    left: 10px;
    width: 280px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
}

.search-item {
    padding: 10px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.search-item:hover {
    background: #f5f6f6;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        position: relative;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
    }

    .chat-area {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10;
    }

    .chat-area.active {
        display: flex;
    }

    .chat-name h4 {
        font-size: 1rem;
        font-weight: normal;
        color: #111b21;
    }

    .chat-time {
        font-size: 0.75rem;
        color: #667781;
    }

    .chat-preview {
        display: flex;
        justify-content: space-between;
        font-size: 0.85rem;
        color: #667781;
    }

    /* Chat Area */
    .chat-area {
        flex: 1;
        display: flex;
        flex-direction: column;
        background: var(--chat-bg);
        position: relative;
    }

    .chat-header {
        padding: 10px 16px;
        background: #f0f2f5;
        display: flex;
        align-items: center;
        height: 60px;
        border-left: 1px solid #d1d7db;
    }

    .back-btn {
        display: none;
        background: none;
        border: none;
        font-size: 1.2rem;
        color: #54656f;
        cursor: pointer;
        margin-right: 15px;
    }

    .user-details h3 {
        font-size: 1rem;
        font-weight: normal;
        color: #111b21;
    }

    .user-details span {
        font-size: 0.8rem;
        color: #667781;
    }

    .messages-container {
        flex: 1;
        padding: 20px;
        overflow-y: auto;
        background-image: url('../images/chat-bg.png');
        /* Optional: Add a subtle pattern */
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .message {
        max-width: 65%;
        padding: 8px 12px;
        border-radius: 8px;
        position: relative;
        font-size: 0.9rem;
        line-height: 1.4;
        box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    }

    .message.sent {
        align-self: flex-end;
        background: var(--message-out);
        border-top-right-radius: 0;
    }

    .message.received {
        align-self: flex-start;
        background: var(--message-in);
        border-top-left-radius: 0;
    }

    .msg-time {
        font-size: 0.7rem;
        color: #667781;
        float: right;
        margin-left: 10px;
        margin-top: 5px;
    }

    .msg-status {
        font-size: 0.7rem;
        margin-left: 3px;
    }

    .msg-status.seen {
        color: #53bdeb;
    }

    .input-area {
        padding: 10px 16px;
        background: #f0f2f5;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .input-area input {
        flex: 1;
        padding: 12px;
        border-radius: 8px;
        border: none;
        outline: none;
    }

    .input-area button {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #54656f;
        cursor: pointer;
    }

    .welcome-screen {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        color: #667781;
        text-align: center;
    }

    .welcome-screen i {
        font-size: 5rem;
        margin-bottom: 20px;
        color: #d1d7db;
    }

    .search-results {
        position: absolute;
        top: 110px;
        left: 10px;
        width: 280px;
        background: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border-radius: 8px;
        z-index: 100;
        max-height: 300px;
        overflow-y: auto;
    }

    .search-item {
        padding: 10px;
        display: flex;
        align-items: center;
        cursor: pointer;
    }

    .search-item:hover {
        background: #f5f6f6;
    }

    /* Mobile Responsiveness */
    @media (max-width: 768px) {
        .app-container {
            position: relative;
        }

        .sidebar {
            width: 100%;
            min-width: 100%;
        }

        .chat-area {
            display: none;
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 10;
        }

        .chat-area.active {
            display: flex;
        }

        .back-btn {
            display: block;
        }

        .sidebar.hidden {
            display: none;
        }
    }

    /* Avatar Upload Styles */
    .avatar-container {
        position: relative;
        display: inline-block;
    }

    .avatar-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        opacity: 0;
        transition: opacity 0.2s;
        color: white;
        font-size: 1rem;
    }

    .avatar-container:hover .avatar-overlay {
        opacity: 1;
    }