/* ---------- Live Chat – Redesigned ---------- */
.chat-open-btn {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0D9B4D, #008136);
    color: #fff;
    border: none;
    font-size: 26px;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 8px 25px rgba(13, 155, 77, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.chat-open-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 30px rgba(13, 155, 77, 0.5);
}
.chat-open-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.chat-popup {
    position: fixed;
    bottom: 170px;
    right: 25px;
    width: 370px;
    max-height: 580px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    font-family: inherit;
    animation: chatSlideUp 0.3s ease;
}
@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #0D9B4D, #008136);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.chat-header img {
    width: 100%;
}
.chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}
.status-bar {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a0a0a0;
}
.status-dot.online { background: #2ecc71; box-shadow: 0 0 0 3px rgba(46,204,113,0.3); }
.chat-header .close-btn {
    cursor: pointer;
    font-size: 22px;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.chat-header .close-btn:hover { opacity: 1; }

/* Form Step */
#userForm {
    padding: 22px 20px;
}
#userForm .form-grp {
    margin-bottom: 14px;
}
#userForm label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    display: block;
}
#userForm input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
#userForm input:focus {
    border-color: #0D9B4D;
}
.start-chat-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #0D9B4D, #008136);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.start-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(13,155,77,0.35);
}

/* Chat Window */
#chatWindow {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 420px;
    background: #f7f9f8;
}
.chat-box {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f7f9f8;
    max-height: 340px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.message {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}
.message.user {
    background: linear-gradient(135deg, #0D9B4D, #008136);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.message.admin {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
/* .typing-indicator {
    font-size: 12px;
    color: #888;
    font-style: italic;
    padding: 0 16px 6px;
    display: none;
} */
 /* Typing indicator – message style with 3 dots */
.typing-indicator {
    display: none;                    /* by default hidden */
    align-self: flex-start;
    background: #fff;
    padding: 7px 11px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin: 0 16px 8px;
    width: fit-content;
}

.typing-indicator .dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input area */
.chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #eee;
    background: #fff;
}
.chat-input input {
    flex: 1;
    border: 1.5px solid #e8e8e8;
    border-radius: 25px;
    padding: 11px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.chat-input input:focus {
    border-color: #0D9B4D;
}
.chat-input button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0D9B4D, #008136);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.chat-input button:hover {
    transform: scale(1.08);
}

/* Mobile */
@media (max-width: 480px) {
    .chat-popup {
        width: calc(100% - 24px);
        right: 12px;
        bottom: 150px;
        max-height: 70vh;
    }
    .chat-open-btn {
        right: 18px;
        bottom: 85px;
    }
}