/* Govi Chat Widget */
#gowi-chatbot-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Toggle button */
#gowi-toggle-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: #E63946;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(230, 57, 70, 0.45), 0 4px 8px rgba(0,0,0,0.15);
    transition: transform .2s ease, box-shadow .2s ease;
    position: relative;
    padding: 0;
}
#gowi-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 32px rgba(230, 57, 70, 0.55);
}
#gowi-toggle-btn .gowi-icon-close { display: none; }
#gowi-toggle-btn.gowi-open .gowi-icon-chat { display: none; }
#gowi-toggle-btn.gowi-open .gowi-icon-close { display: inline-flex; }

#gowi-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    color: #E63946;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
    display: none;
}
#gowi-unread-badge.gowi-show { display: block; }

/* Chat window */
#gowi-chat-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 540px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    transition: transform .25s ease, opacity .25s ease;
}
#gowi-chat-window.gowi-open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* Header */
#gowi-chat-header {
    background: linear-gradient(135deg, #E63946 0%, #c1121f 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}
.gowi-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.gowi-header-info { flex: 1; line-height: 1.2; }
.gowi-bot-name { font-weight: 700; font-size: 16px; }
.gowi-online {
    font-size: 12px;
    opacity: 0.92;
    display: flex;
    align-items: center;
}
.gowi-online::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    margin-right: 6px;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, .3);
}
#gowi-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    opacity: .9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#gowi-close-btn:hover { background: rgba(255,255,255,0.15); opacity: 1; }

/* Messages */
#gowi-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
#gowi-messages::-webkit-scrollbar { width: 4px; }
#gowi-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 4px; }

.gowi-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    animation: gowiFadeIn .25s ease;
    word-wrap: break-word;
}
@keyframes gowiFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.gowi-msg-bot {
    background: #fff;
    color: #1f2937;
    align-self: flex-start;
    border-radius: 4px 16px 16px 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.gowi-msg-user {
    background: #E63946;
    color: #fff;
    align-self: flex-end;
    border-radius: 16px 4px 16px 16px;
}
.gowi-msg a { color: inherit; text-decoration: underline; }

/* Typing */
.gowi-typing {
    background: #fff;
    align-self: flex-start;
    border-radius: 4px 16px 16px 16px;
    padding: 12px 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    display: inline-flex;
    gap: 4px;
}
.gowi-typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c1121f;
    animation: gowiBounce 1.2s infinite ease-in-out;
}
.gowi-typing span:nth-child(2) { animation-delay: .15s; }
.gowi-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes gowiBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: .5; }
    40% { transform: translateY(-5px); opacity: 1; }
}

/* Quick replies */
#gowi-quick-replies {
    background: #f8f9fa;
    padding: 0 12px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 110px;
    overflow-y: auto;
}
.gowi-qr-btn {
    background: #fff;
    color: #E63946;
    border: 1.5px solid #E63946;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s ease;
    font-weight: 500;
}
.gowi-qr-btn:hover {
    background: #E63946;
    color: #fff;
}

/* Input row */
#gowi-input-row {
    background: #fff;
    border-top: 1px solid #eee;
    padding: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}
#gowi-user-input {
    flex: 1;
    border: 1.5px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s ease;
    font-family: inherit;
}
#gowi-user-input:focus { border-color: #E63946; }
#gowi-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #E63946;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease, background .15s ease;
}
#gowi-send-btn:hover { background: #c1121f; transform: scale(1.06); }

/* Footer */
#gowi-footer-brand {
    text-align: center;
    padding: 6px 8px 10px;
    font-size: 11px;
    color: #9ca3af;
    background: #fff;
}
#gowi-footer-brand a { color: #E63946; text-decoration: none; font-weight: 600; }

/* Mobile */
@media (max-width: 480px) {
    #gowi-chatbot-wrapper { bottom: 16px; right: 16px; }
    #gowi-chat-window {
        width: calc(100vw - 32px);
        height: 70vh;
        max-height: 580px;
        bottom: 72px;
    }
}
