/* =====================================================
   LARALI MITRA DIGITAL
   CHAT.CSS - LIVE CUSTOMER SERVICE
===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', Arial, sans-serif;
}

:root {
    --green: #07883f;
    --green-dark: #056b31;
    --green-light: #eaf8f0;
    --green-soft: #f4fbf7;

    --text: #17201b;
    --muted: #7b8580;

    --white: #ffffff;
    --border: #e1e7e3;

    --background: #f4f7f5;

    --user-message: #07883f;
    --admin-message: #ffffff;
}


/* =====================================================
   BODY
===================================================== */

body {
    width: 100%;
    height: 100vh;

    background:
        radial-gradient(
            circle at 0% 0%,
            rgba(7,136,63,.08),
            transparent 30%
        ),
        var(--background);

    color: var(--text);

    overflow: hidden;
}


/* =====================================================
   HEADER
===================================================== */

.chat-header {
    position: fixed;

    top: 0;
    left: 50%;

    z-index: 100;

    transform:
        translateX(-50%);

    width: 100%;
    max-width: 520px;

    height: 67px;

    display: flex;
    align-items: center;

    gap: 10px;

    padding: 9px 12px;

    background:
        linear-gradient(
            135deg,
            #078e42,
            #067737
        );

    color: #ffffff;

    box-shadow:
        0 5px 18px
        rgba(0,0,0,.12);
}


/* =====================================================
   BACK BUTTON
===================================================== */

.icon-btn {
    width: 42px;
    height: 42px;

    min-width: 42px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: none;

    border-radius: 12px;

    background:
        rgba(255,255,255,.14);

    color: #ffffff;

    cursor: pointer;

    transition: .2s ease;
}


.icon-btn:hover {
    background:
        rgba(255,255,255,.22);
}


.icon-btn:active {
    transform:
        scale(.94);
}


.icon-btn .material-icons {
    font-size: 21px;
}


/* =====================================================
   CS INFO
===================================================== */

.cs-info {
    display: flex;

    align-items: center;

    gap: 10px;

    min-width: 0;
}


.cs-avatar {
    width: 42px;
    height: 42px;

    min-width: 42px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background:
        rgba(255,255,255,.18);

    color: #ffffff;
}


.cs-avatar .material-icons {
    font-size: 23px;
}


.cs-info h1 {
    margin-bottom: 2px;

    color: #ffffff;

    font-size: 14px;

    font-weight: 700;
}


.online-status {
    display: flex;

    align-items: center;

    gap: 5px;

    color:
        rgba(255,255,255,.84);

    font-size: 8px;
}


.online-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background:
        #7df5a9;

    box-shadow:
        0 0 0 3px
        rgba(125,245,169,.15);
}


/* =====================================================
   CHAT AREA
===================================================== */

.chat-messages {
    position: fixed;

    top: 67px;
    bottom: 104px;

    left: 50%;

    transform:
        translateX(-50%);

    width: 100%;
    max-width: 520px;

    padding: 16px 12px 20px;

    overflow-y: auto;

    scroll-behavior: smooth;
}


/* =====================================================
   WELCOME
===================================================== */

.welcome {
    width: 90%;

    max-width: 330px;

    margin:
        25px auto;

    padding: 20px;

    border:
        1px solid
        var(--border);

    border-radius: 20px;

    background:
        rgba(255,255,255,.88);

    text-align: center;

    box-shadow:
        0 5px 16px
        rgba(0,0,0,.04);
}


.welcome-icon {
    width: 55px;
    height: 55px;

    margin:
        0 auto 11px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background:
        var(--green-light);

    color:
        var(--green);
}


.welcome-icon .material-icons {
    font-size: 28px;
}


.welcome h2 {
    margin-bottom: 7px;

    color:
        var(--text);

    font-size: 16px;
}


.welcome p {
    color:
        var(--muted);

    font-size: 9px;

    line-height: 1.7;
}


/* =====================================================
   MESSAGE ROW
===================================================== */

.message-row {
    display: flex;

    width: 100%;

    margin-bottom: 10px;
}


.message-row.member {
    justify-content: flex-end;
}


.message-row.admin {
    justify-content: flex-start;
}


/* =====================================================
   MESSAGE BUBBLE
===================================================== */

.message-bubble {
    max-width: 78%;

    padding:
        10px 12px;

    border-radius: 15px;

    font-size: 10px;

    line-height: 1.6;

    word-break: break-word;

    box-shadow:
        0 2px 8px
        rgba(0,0,0,.035);
}


/* MEMBER */

.message-row.member
.message-bubble {

    border-bottom-right-radius: 4px;

    background:
        var(--user-message);

    color:
        #ffffff;
}


/* ADMIN */

.message-row.admin
.message-bubble {

    border:
        1px solid
        var(--border);

    border-bottom-left-radius: 4px;

    background:
        var(--admin-message);

    color:
        var(--text);
}


/* =====================================================
   MESSAGE TIME
===================================================== */

.message-meta {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: 5px;

    margin-top: 4px;

    font-size: 7px;

    opacity: .72;
}


.message-row.admin
.message-meta {

    justify-content: flex-start;
}


.message-status {
    display: inline-flex;

    align-items: center;
}


/* =====================================================
   TYPING
===================================================== */

.typing-indicator {
    position: fixed;

    left: 50%;
    bottom: 76px;

    z-index: 50;

    transform:
        translateX(-50%);

    width: 100%;
    max-width: 520px;

    display: none;

    align-items: center;

    gap: 4px;

    padding:
        0 15px;

    color:
        var(--muted);

    font-size: 8px;
}


.typing-indicator span {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background:
        var(--green);

    animation:
        typing .9s infinite;
}


.typing-indicator span:nth-child(2) {
    animation-delay:
        .15s;
}


.typing-indicator span:nth-child(3) {
    animation-delay:
        .30s;
}


.typing-indicator small {
    margin-left: 4px;

    font-size: 8px;
}


@keyframes typing {

    0%,
    60%,
    100% {
        opacity: .3;
        transform:
            translateY(0);
    }

    30% {
        opacity: 1;
        transform:
            translateY(-3px);
    }

}


/* =====================================================
   INPUT AREA
===================================================== */

.chat-input-area {
    position: fixed;

    left: 50%;
    bottom: 0;

    z-index: 100;

    transform:
        translateX(-50%);

    width: 100%;
    max-width: 520px;

    padding:
        9px 11px 10px;

    border-top:
        1px solid
        var(--border);

    background:
        rgba(255,255,255,.97);

    box-shadow:
        0 -5px 18px
        rgba(0,0,0,.06);

    backdrop-filter:
        blur(10px);
}


/* =====================================================
   INPUT WRAPPER
===================================================== */

.input-wrapper {
    display: flex;

    align-items: flex-end;

    gap: 7px;

    width: 100%;

    padding:
        5px 5px 5px 12px;

    border:
        1px solid
        var(--border);

    border-radius: 16px;

    background:
        #fbfcfb;

    transition: .2s ease;
}


.input-wrapper:focus-within {
    border-color:
        var(--green);

    background:
        #ffffff;

    box-shadow:
        0 0 0 3px
        rgba(7,136,63,.07);
}


/* =====================================================
   TEXTAREA
===================================================== */

#messageInput {
    flex: 1;

    width: 100%;

    min-height: 36px;
    max-height: 100px;

    padding:
        8px 0;

    border: none;

    outline: none;

    resize: none;

    overflow-y: auto;

    background:
        transparent;

    color:
        var(--text);

    font-family:
        inherit;

    font-size: 10px;

    line-height: 1.5;
}


#messageInput::placeholder {
    color:
        #a4ada7;
}


/* =====================================================
   SEND BUTTON
===================================================== */

.send-btn {
    width: 38px;
    height: 38px;

    min-width: 38px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: none;

    border-radius: 12px;

    background:
        var(--green);

    color:
        #ffffff;

    cursor: pointer;

    transition: .2s ease;
}


.send-btn:hover:not(:disabled) {
    background:
        var(--green-dark);

    transform:
        translateY(-1px);
}


.send-btn:active:not(:disabled) {
    transform:
        scale(.94);
}


.send-btn:disabled {
    background:
        #d3dbd6;

    color:
        #ffffff;

    cursor:
        not-allowed;

    box-shadow:
        none;
}


.send-btn .material-icons {
    font-size: 19px;
}


/* =====================================================
   INPUT INFO
===================================================== */

.input-info {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    padding:
        5px 3px 0;

    color:
        #a0aaa4;

    font-size: 7px;
}


#charCount {
    flex-shrink: 0;
}


/* =====================================================
   LOADING
===================================================== */

.loading {
    position: fixed;

    inset: 0;

    z-index: 9999;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    background:
        rgba(255,255,255,.94);

    backdrop-filter:
        blur(3px);
}


.loader {
    width: 40px;
    height: 40px;

    border:
        4px solid
        #e4ebe6;

    border-top-color:
        var(--green);

    border-radius: 50%;

    animation:
        spin .8s linear infinite;
}


.loading p {
    margin-top: 10px;

    color:
        var(--muted);

    font-size: 9px;
}


@keyframes spin {

    from {
        transform:
            rotate(0deg);
    }

    to {
        transform:
            rotate(360deg);
    }

}


/* =====================================================
   SCROLLBAR
===================================================== */

.chat-messages::-webkit-scrollbar,
#messageInput::-webkit-scrollbar {
    width: 4px;
}


.chat-messages::-webkit-scrollbar-thumb,
#messageInput::-webkit-scrollbar-thumb {
    background:
        #c9d2cc;

    border-radius:
        20px;
}


.chat-messages::-webkit-scrollbar-track,
#messageInput::-webkit-scrollbar-track {
    background:
        transparent;
}


/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 380px) {

    .chat-header {
        height: 62px;

        padding:
            8px 9px;
    }


    .chat-messages {
        top: 62px;

        bottom: 101px;

        padding:
            13px 9px 18px;
    }


    .chat-input-area {
        padding:
            8px 8px 9px;
    }


    .message-bubble {
        max-width: 84%;

        font-size:
            9px;
    }


    .welcome {
        padding:
            17px;
    }

}