
/* ===== Global Styles ===== */
body {
    background-color: #e5ddd5; /* WhatsApp background pattern */
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

/* Subtle pattern overlay */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="%23e5ddd5" opacity="0.4"/></svg>');
    opacity: 0.03;
    pointer-events: none;
    z-index: -1;
}

/* ===== Chat Wrapper ===== */
.chat-wrapper {
    display: flex;
    height: calc(100vh - 56px); /* adjust if navbar height differs */
    max-width: 1400px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

/* ===== Contact List ===== */
.contact-list {
    width: 30%;
    min-width: 300px;
    background-color: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.contact-header {
    padding: 20px 15px;
    background-color: #f6f6f6;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    color: #4a4a4a;
}

.contact-list-items {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.contact-item {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.contact-item:hover {
    background-color: #f5f5f5;
}

.contact-item.active {
    background-color: #e8f5fe;
}

.contact-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.avatar {
    margin-right: 12px;
    color: #7f8c8d;
}

.avatar i {
    font-size: 40px;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 5px;
}

.online-dot {
    width: 10px;
    height: 10px;
    background-color: #2ecc71;
    border-radius: 50%;
    display: inline-block;
}

.contact-last-seen {
    font-size: 0.8rem;
    color: #95a5a6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background-color: #06d755;
    color: #fff;
    border-radius: 50%;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0 5px;
    margin-left: 5px;
}

/* ===== Chat Area ===== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #e5ddd5; /* WhatsApp chat background */
    background-image: linear-gradient(rgba(255,255,255,0.2) 1px, transparent 1px);
    background-size: 100% 20px;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #f6f6f6;
    border-bottom: 1px solid #e0e0e0;
}

.back-btn {
    color: #2c3e50;
    margin-right: 10px;
    padding: 0;
}

.chat-user-info {
    margin-left: 10px;
}

.chat-user-name {
    font-weight: 600;
    color: #2c3e50;
}

.chat-user-status {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
}

/* Message Bubbles */
.message {
    margin-bottom: 10px;
    display: flex;
}

.message.incoming {
    justify-content: flex-start;
}

.message.outgoing {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.incoming .message-bubble {
    background-color: #fff;
    border-bottom-left-radius: 4px;
}

.outgoing .message-bubble {
    background-color: #dcf8c6;
    border-bottom-right-radius: 4px;
}

.message-text {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #303030;
}

.message-time {
    font-size: 0.7rem;
    color: #7f8c8d;
    text-align: right;
    margin-top: 3px;
}

.no-messages {
    text-align: center;
    color: #95a5a6;
    margin-top: 20px;
    font-style: italic;
}

.no-chat-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #95a5a6;
}

/* Chat Input Area */
.chat-input-area {
    background-color: #f6f6f6;
    padding: 12px 15px;
    border-top: 1px solid #e0e0e0;
}

.chat-input-area .input-group {
    align-items: center;
}

.emoji-btn {
    border: none;
    background: transparent;
    color: #7f8c8d;
    font-size: 1.5rem;
    padding: 0 10px;
}

.emoji-btn:hover {
    color: #2c3e50;
}

#message-input {
    border: none;
    border-radius: 24px !important;
    background-color: #fff;
    padding: 10px 15px;
    font-size: 0.95rem;
    box-shadow: none;
}

#message-input:focus {
    box-shadow: 0 0 0 2px rgba(6, 215, 85, 0.3);
}

.send-btn {
    border-radius: 50% !important;
    width: 45px;
    height: 45px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #06d755 !important;
    border: none !important;
    color: #fff;
    margin-left: 10px;
}

.send-btn:hover {
    background-color: #05b54a !important;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .chat-wrapper {
        height: calc(100vh - 56px);
    }

    .contact-list {
        width: 100%;
        min-width: 100%;
    }

    .chat-area {
        width: 100%;
    }

    .d-none {
        display: none !important;
    }

    .d-md-block {
        display: block !important;
    }
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}