﻿/* --- MitraChat Core Responsive Layout --- */
.chat-container {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
    position: relative;
    background-color: #f0f2f5;
}
/*
 Sidebar Styling */
.sidebar {
    width: 380px;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e9edef;
    background: #ffffff;
    transition: transform 0.3s ease-in-out;
    z-index: 5;
}

/* Chat Window Styling */
.chat-window {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #efeae2;
    transition: transform 0.3s ease-in-out;
    z-index: 4;
}

/* Mitra List Item Interactive Row */
.user-item {
    cursor: pointer !important;
    position: relative !important;
    user-select: none;
    transition: background 0.2s ease;
    z-index: 1;
}

    .user-item:hover, .user-item.active {
        background-color: #f0f2f5 !important;
    }

    /* Child Elements Block Engine Bypass */
    .user-item * {
        pointer-events: none !important;
    }

    /* Status Dot Overlay Engine */
    .user-item .position-relative {
        position: relative !important;
        display: inline-block;
        pointer-events: none !important;
    }

.status-dot {
    position: absolute !important;
    bottom: 2px !important;
    right: 2px !important;
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    border: 2px solid #ffffff !important;
    z-index: 99 !important;
    display: block !important;
}

    .status-dot.online {
        background-color: #25d366 !important;
    }

    .status-dot.offline {
        background-color: #8696a0 !important;
    }

/* Mobile View Back Arrow Trigger */
.back-to-sidebar-btn {
    display: none;
    cursor: pointer;
    font-size: 22px;
    margin-right: 15px;
    color: #54656f;
    align-items: center;
}

/* ========================================================
   💬 MODERN MESSAGE BUBBLES STYLING
   ======================================================== */
#message-area-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px !important;
}

.msg-row {
    display: flex;
    width: 100%;
    margin-bottom: 2px;
}

    .msg-row.sent {
        justify-content: flex-end;
    }

    .msg-row.received {
        justify-content: flex-start;
    }

.bubble {
    max-width: 65%;
    padding: 8px 14px;
    border-radius: 12px;
    position: relative;
    font-size: 15px;
    line-height: 1.4;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
    word-wrap: break-word;
    display: inline-flex;
    flex-direction: column;
}
/* 🔥 LIGHT MODE (Tera purana code) 🔥 */
.msg-row.received .bubble {
    background-color: #ffffff !important;
    color: #111b21 !important;
    border-top-left-radius: 0px;
    border-bottom-right-radius: 0px;
}

.msg-row.sent .bubble {
    background-color: #d9fdd3 !important;
    color: #111b21 !important;
    border-top-right-radius: 0px;
    border-bottom-left-radius: 0px;
}

body.dark-mode .msg-row.received .bubble {
    background-color: #2a3942 !important;
    color: #e9edef !important;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5) !important; /* Halka sa shadow */
    border: 1px solid rgba(255, 255, 255, 0.08) !important; /* Ekdam subtle white outline */
}

body.dark-mode .msg-row.sent .bubble {
    background-color: #005c4b !important;
    color: #e9edef !important;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5) !important; /* Halka sa shadow */
    border: 1px solid rgba(255, 255, 255, 0.08) !important; /* Ekdam subtle white outline */
}

/* 🔥 WhatsApp Style Call Notification Badge 🔥 */
.wa-call-badge {
    padding: 6px 14px !important;
    border-radius: 8px !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    width: fit-content !important;
    margin: 8px auto !important;
    text-align: center !important;
    display: table !important;
}

/* Light Mode Badge */
body:not(.dark-mode) .wa-call-badge {
    background-color: #f0f2f5 !important;
    color: #54656f !important;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1) !important;
}

/* Dark Mode Badge */
body.dark-mode .wa-call-badge {
    background-color: #182229 !important;
    color: #8696a0 !important;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) !important;
}

/* 🔥 WhatsApp Style Date Header Bubble 🔥 */
.wa-date-bubble {
    font-size: 12.5px !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    display: inline-block !important;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15) !important;
}

/* Light Mode Date Bubble */
body:not(.dark-mode) .wa-date-bubble {
    background-color: #ffffff !important;
    color: #54656f !important;
}

/* Dark Mode Date Bubble */
body.dark-mode .wa-date-bubble {
    background-color: #182229 !important;
    color: #8696a0 !important;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) !important;
}

.bubble-text {
    padding-right: 3px;
    font-weight: 400;
}

.bubble-time {
    font-size: 11px;
    color: #667781;
    align-self: flex-end;
    bottom: 4px;
    right: 8px;
    user-select: none;
}

/* 🔥 FIXED: Emoji and Chat Footer Input Layout */
.chat-footer {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background-color: #f0f2f5;
    border-top: 1px solid #e9edef;
    gap: 12px;
}

.emoji-trigger-btn {
    background: none;
    border: none;
    padding: 4px;
    margin: 0;
    cursor: pointer !important;
    color: #54656f;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 10 !important; 
    pointer-events: auto !important;
}

    .emoji-trigger-btn:hover {
        color: #111b21;
    }

.chat-input-wrapper {
    flex-grow: 1;
    position: relative;
}

.chat-footer .form-control {
    border-radius: 8px;
    border: none;
    padding: 9px 12px;
    font-size: 15px;
    background-color: #ffffff;
}

    .chat-footer .form-control:focus {
        box-shadow: none;
        background-color: #ffffff;
    }

.send-action-btn {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer !important;
    color: #00a884;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: scale 0.1s ease;
}

    .send-action-btn:active {
        transform: scale(0.95);
    }

/* WhatsApp Ticks Styling */
.tick-status {
    font-size: 0.85rem;
    margin-left: 5px;
    vertical-align: middle;
}

.tick-sent {
    color: #9e9e9e;
}
/* Single Gray Tick */
.tick-delivered {
    color: #8a8a8a;
}
/* Double Gray Tick */
.tick-read {
    color: #34b7f1;
}
/* Double Blue Tick */
.msg-meta {
    text-align: end !important;
}


/* 🔥 Perfect Portrait Fit for PiP Video */
body.pip-mode #whatsapp-call-screen {
    width: 100% !important;
    height: 100% !important;
}

body.pip-mode video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* 🔥 Chhote screen par strict timer hide aur bade par display */
body.pip-mode #call-status-text {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Base Video Layout Fix for Swapping */
#video-area {
    position: relative;
    width: 100%;
    height: 100%;
}

#remote-camera {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#my-camera {
    position: absolute;
    bottom: 90px;
    right: 20px;
    width: 100px;
    height: 140px;
    object-fit: cover;
    z-index: 99;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
}


#video-area.swapped-videos #remote-camera {
    position: absolute;
    bottom: 90px;
    right: 20px;
    width: 100px;
    height: 140px;
    z-index: 99;
    border-radius: 8px;
}

#video-area.swapped-videos #my-camera {
    position: static;
    width: 100%;
    height: 100%;
    border-radius: 0;
}