.chat-container {
    display: flex;
    height: calc(90vh - 100px);
}

/* Left Panel (Chat List) */
.chat-list {
    width: 30%;
    background: #f0f0f0;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

.chat-list h2 {
    background: #ffffff;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.chat-search input {
    width: 90%;
    padding: 8px;
    margin: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.chat-list ul {
    list-style: none;
    padding: 0;
}

.chat-user {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
}

.chat-user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
}

.user-name {
    font-weight: bold;
}

.user-status {
    font-size: 12px;
    color: gray;
}

/* Right Panel (Chat Window) */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f0f0; /* Off-white background */
}

/* Chat Header - Updated */
.chat-header {
    background: #f0f0f0; /* Off-white background */
    padding: 15px;
    font-size: 18px;
    color: #ff4d6d; /* Blue text */
    font-weight: bold;
    text-align: center;
    border-bottom: 1px solid #ddd;
}


.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f0f0f0; /* Matches left panel */
}

.chat-input {
    display: flex;
    padding: 10px;
    background: white;
    border-top: 1px solid #ddd;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
}

.chat-input button {
    background: #ff4d6d;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    margin-left: 10px;
    cursor: pointer;
}

/* Footer Fix */
footer {
    position: relative;
    bottom: 0;
    width: 100%;
    background: #fff;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    border-top: 1px solid #ddd;
}

/* Chat Container Fix - Prevent Stretching */
.chat-container {
    display: flex;
    width: 100%;
    max-width: 1300px; /* Prevents exceeding screen size */
    margin: 0 auto;
    height: 80vh;
    border-radius: 10px;
    overflow: hidden;
}

/* Chat Sidebar */
.chat-sidebar {
    width: 30%;
    min-width: 280px;
    background: #ffffff; /* Off-white */
    padding: 10px;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

/* Chat Messages Panel */
.chat-panel {
    width: 70%;
    background: #f0f0f0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}


.chat-container {
    display: flex;
    height: calc(90vh - 100px);
}

/* Left Panel (Chat List) */
.chat-list {
    width: 30%;
    background: #f0f0f0;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

.chat-list h2 {
    background: #ffffff;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.chat-user {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    position: relative;
}

.unread-badge {
    background: red;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 50%;
    position: absolute;
    right: 10px;
    top: 10px;
    display: none;
}

/* Right Panel (Chat Window) */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f0f0; /* Off-white background */
}


.sent {
    background: #dcf8c6;
    align-self: flex-end;
}

.received {
    background: #fff;
    align-self: flex-start;
}

/* Chat Input */
.chat-input {
    display: flex;
    padding: 10px;
    background: white;
    border-top: 1px solid #ddd;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
}

.chat-input button {
    background: #ff4d6d;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    margin-left: 10px;
    cursor: pointer;
}


.chat-container {
    display: flex;
    height: calc(90vh - 100px);
}

/* Left Panel (Chat List) */
.chat-list {
    width: 30%;
    background: #f0f0f0;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

.chat-list h2 {
    background: #ffffff;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.chat-user {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    position: relative;
}

.unread-badge {
    background: red;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 50%;
    position: absolute;
    right: 10px;
    top: 10px;
    display: none;
}

/* Right Panel (Chat Window) */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f0f0; /* Off-white background */
}


.sent {
    background: #dcf8c6;
    align-self: flex-end;
    text-align: right;
}

.received {
    background: #fff;
    align-self: flex-start;
    text-align: left;
}

/* Chat Input */
.chat-input {
    display: flex;
    padding: 10px;
    background: white;
    border-top: 1px solid #ddd;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
}

.chat-input button {
    background: #ff4d6d;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    margin-left: 10px;
    cursor: pointer;
}

.chat-container {
    display: flex;
    height: calc(90vh - 100px);
}

/* Left Panel (Chat List) */
.chat-list {
    width: 30%;
    background: #f0f0f0;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

.chat-list h2 {
    background: #ffffff;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.chat-user {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    position: relative;
}

.unread-badge {
    background: red;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 50%;
    position: absolute;
    right: 10px;
    top: 10px;
    display: none;
}

/* Right Panel (Chat Window) */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f0f0; /* Off-white background */
}



/* Chat Input */
.chat-input {
    display: flex;
    padding: 10px;
    background: white;
    border-top: 1px solid #ddd;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
}

.chat-input button {
    background: #ff4d6d;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    margin-left: 10px;
    cursor: pointer;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f0f0f0;
}

/* ✅ Align Sent Messages to Right */
.chat-message.sent {
    text-align: right;
    background: #ff8090;
    color: black;
    padding: 10px;
    border-radius: 10px;
    margin: 5px 0;
    max-width: 75%;
    align-self: flex-end;
    font-size: 14px;
}

/* ✅ Align Received Messages to Left */
.chat-message.received {
    text-align: left;
    background: white;
    color: black;
    padding: 10px;
    border-radius: 10px;
    margin: 5px 0;
    max-width: 75%;
    align-self: flex-start;
    font-size: 14px;
}

/* ✅ Time Stamp for Messages */
.msg-time {
    display: block;
    font-size: 9px;
    color: grey;
    text-align: right;
    margin-top: 5px;
}

/* ✅ Unread message badge */
.new-message-badge {
    font-size: 14px;
    color: red;
    font-weight: bold;
    margin-left: 10px;
}
.msg-badge {
    font-size: 14px;
    color: red;
    font-weight: bold;
    margin-left: 8px;
    visibility: hidden; /* Initially hidden */
}

/* ✅ Make Badge Visible When It Has Content */
.msg-badge:not(:empty) {
    visibility: visible;
}
#start-video-call {
    display: none !important; /* ✅ Force hiding the button */
}

.user-name-link, .chat-profile-link {
    color: #ff4d6d; /*  Website theme color */
    font-weight: bold;
    text-decoration: none;
}

.user-name-link:hover, .chat-profile-link:hover {
    text-decoration: underline;
}






/* Container */
.chat-container {
    display: flex;
    height: 90vh;
    overflow: hidden;
}

/* Sidebar List */
.chat-list {
    width: 100%;
    max-width: 370px;
    min-width: 220px;
    border-right: 1px solid #ffe3f0;
    overflow-y: auto;
    background: #fff;
    margin: 0 auto;
    box-shadow: 0 2px 10px #ffd4ea22;
    border-radius: 20px 0 0 20px;
    padding: 22px 0 10px 0;
}

/* Title */
.chat-list h2 {
    text-align: center;
    color: #d7216d;
    margin-bottom: 10px;
    margin-top: 0;
    font-size: 2.2em;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Search bar */
.chat-search {
    margin: 0 20px 10px 20px;
}
.chat-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #ffd4ea;
    border-radius: 10px;
    font-size: 1em;
    outline: none;
    background: #fcf6f9;
    margin-bottom: 10px;
}

/* Chat users list */
#chat-users-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
#chat-users-list li.chat-user {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 11px 18px;
    border-bottom: 1px solid #ffe3f0;
    gap: 14px;
    background: #fff;
    border-radius: 12px;
    margin: 5px 6px;
    transition: background .13s, box-shadow .16s;
    box-shadow: 0 1px 8px #ffd4ea12;
}
#chat-users-list li.chat-user:hover {
    background: #ffe3f08a;
    box-shadow: 0 2px 12px #ffd4ea25;
}
#chat-users-list li.chat-user img {
    border-radius: 50%;
    margin-right: 10px;
    border: 2.5px solid #ff5b89;
    width: 46px;
    height: 46px;
    object-fit: cover;
}
#chat-users-list li.chat-user > div {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.user-name-link {
    font-weight: bold;
    color: #d7216d;
    text-decoration: none;
    margin-right: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    display: inline-block;
}
.user-status {
    font-size: 0.9em;
    color: #888;
    margin-right: 8px;
}
.delete-chat-btn {
    background: #ff5b89;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    margin-left: auto;
}
.delete-chat-btn:hover { background: #ff174d; }

/* Message badge style */
.new-message-badge {
    background: #ffe084;
    color: #b77d04;
    font-weight: bold;
    border-radius: 14px;
    padding: 2px 7px;
    font-size: 0.98em;
    margin-left: 4px;
    display: none;
}

/* Chat window (right panel) */
.chat-window {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #faf6f9;
}

/* Chat header (user info bar) */
.chat-header {
    background: #f5f5f5;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1.5px solid #ffd4ea;
}
.chat-header .back-btn {
    display: none;
    font-size: 20px;
    margin-right: 10px;
    cursor: pointer;
}
.chat-header .chat-user-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #d7216d;
}

/* Chat messages area */
.chat-messages {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
}

/* Input area */
.chat-input {
    display: flex;
    border-top: 1.5px solid #ffd4ea;
    background: #fff;
}
.chat-input input {
    flex-grow: 1;
    padding: 14px 10px;
    border: none;
    border-radius: 0;
    font-size: 1.03em;
    outline: none;
    background: #fff;
}
.chat-input button {
    padding: 13px 20px;
    background: #d7216d;
    color: #fff;
    border: none;
    border-radius: 0 7px 7px 0;
    font-size: 1em;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.15s;
}
.chat-input button:hover {
    background: #ff5b89;
}

/* Responsive design */
@media (max-width: 1000px) {
    .chat-list {
        max-width: 290px;
    }
    .user-name-link { max-width: 80px; }
}
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        height: auto;
        min-height: 90vh;
    }
    .chat-list {
        width: 98vw;
        max-width: 98vw;
        border-radius: 0 0 22px 22px;
        padding: 16px 2vw 5px 2vw;
        border-right: none;
        border-bottom: 1px solid #ffe3f0;
        box-shadow: none;
    }
    .chat-window {
        position: absolute;
        width: 100vw;
        height: calc(100% - 60px); /* pushes it below the pink header */
        background: #faf6f9;
        top: 60px; /* height of .main-header-bar */
        left: 0;
        z-index: 9999;
        display: none;
    }
    .chat-window.active {
        display: flex;
        flex-direction: column;
    }
    .chat-header {
        height: 60px;
        background: white;
        display: flex;
        align-items: center;
        padding: 0 10px;
        z-index: 10000;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    .chat-header .back-btn {
        display: inline-block;
        font-size: 24px;
        margin-right: 15px;
        cursor: pointer;
    }
    .user-name-link { max-width: 68vw; }
}
@media (max-width: 480px) {
    .chat-list {
        max-width: 100vw;
        padding: 12px 2vw 5px 2vw;
    }
    #chat-users-list li.chat-user {
        padding: 9px 3vw;
    }
}
