﻿/* ================= APP ================= */
.chat-app {
    display: flex;
    height: calc(100vh - 110px);
    background: #efeae2;
    font-family: "Segoe UI", Roboto, Arial;
}

/* ================= LEFT ================= */
.chat-list {
    width: 340px;
    background: #fff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.chat-list-header {
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 600;
}

.chat-search {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

    .chat-search input {
        width: 100%;
        padding: 8px 12px;
        border-radius: 20px;
        border: 1px solid #ddd;
        outline: none;
    }

/* ================= CHAT LIST ================= */
.chat-items {
    overflow-y: auto;
}

.chat-item {
    display: flex;
    padding: 10px 12px;
    text-decoration: none;
    color: #111;
    border-bottom: 1px solid #f1f1f1;
}

    .chat-item:hover {
        background: #f5f6f6;
    }

    .chat-item.active {
        background: #e9edef;
    }

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #cfd4d8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 10px;
}

.chat-meta {
    flex: 1;
}

    .chat-meta .top {
        display: flex;
        justify-content: space-between;
    }

    .chat-meta .name {
        font-weight: 600;
    }

    .chat-meta .time {
        font-size: 12px;
        color: #777;
    }

    .chat-meta .preview {
        font-size: 13px;
        color: #777;
    }

/* ================= RIGHT ================= */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* HEADER */
.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #f0f2f5;
    border-bottom: 1px solid #ddd;
}

.header-meta .name {
    font-weight: 600;
}

.header-meta .status {
    font-size: 12px;
    color: #666;
}

/* ================= MESSAGES ================= */
.messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* ================= BUBBLES ================= */
.bubble {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

    .bubble.in {
        background: #ffffff;
        align-self: flex-start;
        margin-right: auto;
    }

    .bubble.out {
        background: #dcf8c6;
        align-self: flex-end;
        margin-left: auto;
    }

    .bubble .meta {
        font-size: 11px;
        color: #666;
        text-align: right;
        margin-top: 4px;
    }

/* ================= IMAGE MESSAGE (FIXED) ================= */
.media.image {
    max-width: 280px;
}

    .media.image img {
        width: 100%;
        height: auto;
        max-height: 420px;
        border-radius: 8px;
        object-fit: contain; /* 🔥 MOST IMPORTANT */
        cursor: pointer;
        display: block;
    }

.bubble.out .media.image {
    margin-left: auto;
}

/* Mobile */
@media (max-width: 768px) {
    .media.image {
        max-width: 220px;
    }
}

/* ================= REPLY ================= */
.reply-box {
    display: flex;
    padding: 10px;
    background: #f0f2f5;
    border-top: 1px solid #ddd;
}

    .reply-box input {
        flex: 1;
        padding: 10px 14px;
        border-radius: 20px;
        border: 1px solid #ccc;
    }

    .reply-box button {
        margin-left: 10px;
        padding: 8px 18px;
        border-radius: 6px;
        background: #0b5ed7;
        color: #fff;
        border: none;
    }

/* ================= IMAGE MODAL ================= */
.img-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

    .img-modal img {
        max-width: 90%;
        max-height: 90%;
        border-radius: 8px;
    }
/* ================= VIDEO MESSAGE ================= */
.media.video {
    max-width: 320px;
    border-radius: 8px;
    overflow: hidden;
}

    .media.video video {
        width: 100%;
        height: auto;
        max-height: 420px;
        border-radius: 8px;
        object-fit: contain; /* 🔥 SAME AS IMAGE */
        background: #000;
        display: block;
    }

/* OUT video right align */
.bubble.out .media.video {
    margin-left: auto;
}

/* Mobile */
@media (max-width: 768px) {
    .media.video {
        max-width: 240px;
    }
}
.media.document {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f6f6;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 320px;
}

    .media.document a {
        text-decoration: none;
        color: #0b5ed7;
        font-weight: 500;
        word-break: break-word;
    }

.meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #666;
}

/* Ticks base */
.ticks {
    font-size: 13px;
    letter-spacing: -1px;
}

    /* Sent ✔ */
    .ticks.sent {
        color: #999;
    }

    /* Delivered ✔✔ */
    .ticks.delivered {
        color: #999;
    }

    /* Read ✔✔ (Blue) */
    .ticks.read {
        color: #34b7f1; /* WhatsApp blue */
    }

    /* Failed */
    .ticks.failed {
        color: red;
    }
    /* DATE SEPARATOR */
/* ================= DATE SEPARATOR ================= */
.date-separator {
    top: 10px;
    z-index: 5;
    text-align: center;
    margin: 20px 0;
}

    .date-separator span {
        display: inline-block;
        background: #d9f4ff;
        color: #333;
        font-size: 12px;
        padding: 4px 12px;
        border-radius: 12px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }

    .date-separator span {
        transition: all 0.2s ease;
    }
