:root {
    --primary-color: #38b80a;
    --primary-dark: #1a75e8;
    --primary-light: #e6f2ff;
    --secondary-color: #f0f2f5;
    --text-primary: #1a1a1a;
    --text-secondary: #65676b;
    --border-color: #e4e6eb;
    --chat-bg: #f5f7fb;
    --sent-message: #d9fdd3;
    --received-message: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
}

body {
    background-color: #f0f2f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    background-color: white;
}

/* Sidebar Styles */
.sidebar {
    width: 30%;
    min-width: 300px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background-color: white;
}

.sidebar-header {
    padding: 10px 16px;
    background-color: var(--secondary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.user-avatar {
    color: #000 !important;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.sidebar-icons {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
}

.sidebar-icons i {
    cursor: pointer;
    font-size: 18px;
}

.search-container {
    padding: 8px 12px;
    background-color: white;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    display: flex;
    align-items: center;
    background-color: var(--secondary-color);
    border-radius: 20px;
    padding: 8px 16px;
}

.search-box i {
    color: var(--text-secondary);
    margin-right: 10px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 14px;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-item:hover {
    background-color: var(--secondary-color);
}

.chat-item.active {
    background-color: var(--primary-light);
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #ddd;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.chat-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chat-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.chat-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.chat-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.unread-count {
    background-color: var(--primary-color);
    color: white;
    font-size: 12px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--chat-bg);
}

.chat-header {
    padding: 10px 16px;
    background-color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.chat-contact {
    display: flex;
    align-items: center;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.contact-info h3 {
    font-size: 16px;
    margin-bottom: 2px;
}

.contact-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-actions {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
}

.chat-actions i {
    cursor: pointer;
    font-size: 18px;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 65%;
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
}

.sent {
    align-self: flex-end;
    background-color: var(--sent-message);
    border-top-right-radius: 0;
}

.received {
    align-self: flex-start;
    background-color: var(--received-message);
    border-top-left-radius: 0;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
    margin-top: 4px;
}

.message-image, .message-video {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 5px;
}

.message-contact {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: var(--primary-light);
    border-radius: 8px;
    margin-bottom: 5px;
}

.contact-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.contact-details {
    flex: 1;
}

.contact-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.contact-phone {
    font-size: 13px;
    color: var(--text-secondary);
}

.message-input-container {
    padding: 12px 16px;
    background-color: white;
    display: flex;
    align-items: center;
    border-top: 1px solid var(--border-color);
    position: relative;
}

.input-actions {
    display: flex;
    gap: 15px;
    color: var(--text-secondary);
    margin-right: 15px;
}

.input-actions i {
    cursor: pointer;
    font-size: 20px;
}

.message-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 15px;
    border-radius: 20px;
    background-color: var(--secondary-color);
    font-size: 15px;
}

.send-button {
    background-color: #000;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.send-button:hover {
    background-color: var(--primary-dark);
}

/* Attachment Menu Styles */
.attachment-menu {
    position: absolute;
    bottom: 70px;
    left: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    padding: 10px;
    z-index: 100;
    display: none;
    flex-direction: column;
    width: 180px;
}

.attachment-menu.show {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.attachment-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.attachment-option:hover {
    background-color: var(--secondary-color);
}

.attachment-option i {
    margin-right: 12px;
    font-size: 18px;
    color: var(--primary-color);
}

.attachment-option span {
    font-size: 15px;
    color: var(--text-primary);
}

/* File Input Styling */
.file-input {
    display: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        height: 100%;
        width: 100%;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        display: none;
    }

    .chat-area {
        width: 100%;
    }

    .show-chat .sidebar {
        display: flex;
    }

    .show-chat .chat-area {
        display: none;
    }

    .message {
        max-width: 85%;
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 16px;
        background-color: white;
        border-bottom: 1px solid var(--border-color);
    }

    .back-button {
        color: var(--primary-color);
        font-size: 20px;
        cursor: pointer;
    }

    .attachment-menu {
        left: 10px;
        width: 160px;
    }
}

/* Show chat area by default on desktop */
@media (min-width: 769px) {
    .mobile-header, .back-button {
        display: none;
    }
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--chat-bg);
    text-align: center;
    padding: 20px;
}

.welcome-icon {
    width: 150px;
    height: 150px;
    background-color: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.welcome-icon i {
    font-size: 60px;
    color: var(--primary-color);
}

.welcome-text h1 {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.welcome-text p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.5;
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modal for contact sharing */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
}

.contact-list {
    max-height: 300px;
    overflow-y: auto;
}

.modal-contact {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.modal-contact:last-child {
    border-bottom: none;
}

.modal-contact:hover {
    background-color: var(--secondary-color);
    border-radius: 6px;
    padding-left: 10px;
    padding-right: 10px;
}

.modal-contact-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--primary-color);
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.modal-contact-details {
    flex: 1;
}

.modal-contact-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.modal-contact-phone {
    font-size: 14px;
    color: var(--text-secondary);
}