
/* =========================================
   CHAT BUTTON
========================================= */

#chat-btn {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 999999;
    width: 56px;
    height: 56px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #242f67;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#chat-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

/* =========================================
   CHAT PANEL
========================================= */

.chat-widget {
    position: fixed;
    right: 25px;
    bottom: 100px;
    z-index: 1000000;

    width: 360px;
    height: 465px;
    max-width: calc(100vw - 30px);
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px);
    transform-origin: bottom right;
    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.25s ease;
}

.chat-widget.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
/* =========================================
   HEADER
========================================= */
.chat-header {
    flex: 0 0 58px;
    min-height: 58px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #242f67;
    color: #fff;
}
.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.chat-title img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
}
.chat-title span {
    font-size: 15px;
    font-weight: 700;
}
.close-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 21px;
    cursor: pointer;
}

.close-btn:hover {
    opacity: 0.7;
}

/* =========================================
   ONLINE STATUS
========================================= */
.chat-status {
    flex: 0 0 31px;
    min-height: 31px;
    padding: 7px 14px;
    background: #fff;
    border-bottom: 1px solid #eee;
    color: #555;
    font-size: 11px;
}
.online-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: #2dbd59;
}

/* =========================================
   MESSAGE AREA
========================================= */
.chat-body {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #f5f7fc;
}
.message {
    max-width: 100%;
    padding: 12px 13px;

    border-radius: 14px;

    font-size: 12px;
    line-height: 1.65;

    overflow-wrap: anywhere;
    white-space: normal;
}
.message.support {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.message.user {
    align-self: flex-end;
    background: #242f67;
    color: #fff;
    border-top-right-radius: 4px;
}

/* =========================================
   CHAT FOOTER
========================================= */
.chat-footer {
    flex: 0 0 auto;
    padding: 10px 11px 11px;
    background: #fff;
    border-top: 1px solid #eee;
}

/* =========================================
   QUICK CONTACT BUTTONS
========================================= */
.quick-contact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 8px;
    margin-bottom: 10px;
}
.quick-contact button {
    width: 100%;
    min-width: 0;
    height: 33px;
    padding: 0 6px;
    border: 1px solid #242f67;
    border-radius: 8px;
    background: #fff;
    color: #242f67;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.quick-contact button:hover {
    background: #242f67;
    color: #fff;
}
/* =========================================
   MESSAGE INPUT
========================================= */
.chat-input-row {
    display: flex;
    align-items: center;
    gap: 7px;
}
.chat-input-row input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 37px;
    padding: 0 11px;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    outline: none;
    background: #fff;
    color: #222;
    font-family: inherit;
    font-size: 12px;
}
.chat-input-row input::placeholder {
    color: #888;
}
.chat-input-row input:focus {
    border-color: #242f67;
    box-shadow: 0 0 0 2px rgba(36, 47, 103, 0.08);
}
.send-btn {
    flex: 0 0 39px;
    width: 39px;
    height: 37px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: #242f67;
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.send-btn:hover {
    background: #1c2554;
}

/* =========================================
   MOBILE
========================================= */
@media (max-width: 576px) {
    #chat-btn {
        right: 18px;
        bottom: 18px;
        width: 56px;
        height: 56px;
    }
    .chat-widget {
        right: 15px;
        bottom: 85px;
        width: calc(100vw - 30px);
        height: 465px;
        max-height: calc(100vh - 105px);
        max-height: calc(100dvh - 105px);
        border-radius: 16px;
    }
    .chat-header {
        padding: 9px 12px;
    }
    .chat-body {
        padding: 12px;
    }
    .chat-footer {
        padding: 10px;
    }
}

/* =========================================
   SHORT SCREEN
========================================= */

@media (max-height: 500px) {
    .chat-widget {
        height: calc(100vh - 120px);
        max-height: calc(100vh - 120px);
    }
    .chat-header {
        flex-basis: 50px;
        min-height: 50px;
    }
    .chat-footer {
        padding: 7px 9px;
    }
    .quick-contact {
        gap: 5px;
        margin-bottom: 6px;
    }
    .quick-contact button {
        height: 29px;
    }
}

/* Fix chat panel child alignment and full width */

#chatWidget {
    box-sizing: border-box;
    align-items: stretch;
    padding: 0;
}

#chatWidget .chat-header {
    width: 100%;
    flex: 0 0 58px;
    box-sizing: border-box;
    align-self: stretch;
    justify-content: space-between;
}

#chatWidget .chat-status {
    width: 100%;
    box-sizing: border-box;
    align-self: stretch;
}

#chatWidget .chat-body {
    width: 100%;
    box-sizing: border-box;
    align-self: stretch;
}

#chatWidget .chat-footer {
    width: 100%;
    box-sizing: border-box;
    align-self: stretch;
}

#chatWidget .quick-contact {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

#chatWidget .quick-contact button {
    width: 100%;
    min-width: 0;
}

#chatWidget .chat-input-row {
    width: 100%;
}

#chatWidget .chat-input-row input {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
}

#chatWidget .send-btn {
    flex: 0 0 39px;
}

@media (max-width: 576px) {
    #chatWidget {
        right: 15px;
        width: calc(100vw - 30px);
    }
}

