/* ============================================================
   HOS Chatbot Widget Ã¢â‚¬â€œ BÃ¡Â»â€¡nh viÃ¡Â»â€¡n Tim TÃƒÂ¢m Ã„ÂÃ¡Â»Â©c
   ============================================================ */

/* ---------- Variables ---------- */
:root {
    --hos-chat-primary: #0CAE74;
    --hos-chat-primary-dark: #099960;
    --hos-chat-bg: #ffffff;
    --hos-chat-msg-bg: #f0f4f8;
    --hos-chat-bot-bg: #f0faf5;
    --hos-chat-user-bg: #0CAE74;
    --hos-chat-user-text: #ffffff;
    --hos-chat-text: #1a2b3c;
    --hos-chat-text-muted: #6b7a8d;
    --hos-chat-border: #e2e8f0;
    --hos-chat-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --hos-chat-radius: 16px;
    --hos-chat-width: 380px;
    --hos-chat-height: 560px;
}

/* ---------- Toggle Button ---------- */
.hos-chat__toggle {
 position: fixed;
    bottom: 230px;
    /* left: 7px; */
    right: 10px;
    z-index: 99990;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: #ffbf00;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(12, 174, 116, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hos-chat__toggle::before,
.hos-chat__toggle::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(255, 191, 0, 0.55);
    z-index: -1;
    animation: hosChatRing 1.8s ease-out infinite;
}

.hos-chat__toggle::after {
    animation-delay: 0.9s;
}

.hos-chat__toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(12, 174, 116, 0.45);
}

.hos-chat__toggle-icon {
    width: 26px;
    height: 26px;
    display: block;
    object-fit: contain;
}

@keyframes hosChatRing {
    0% {
        transform: scale(0.9);
        opacity: 0.75;
    }
    70% {
        transform: scale(1.35);
        opacity: 0;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

/* ---------- Chat Window ---------- */
.hos-chat__window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    left: auto;
    z-index: 99991;
    width: var(--hos-chat-width);
    height: var(--hos-chat-height);
    max-height: calc(100vh - 120px);
    max-width: calc(100vw - 24px);
    background: var(--hos-chat-bg);
    border-radius: var(--hos-chat-radius);
    box-shadow: var(--hos-chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--hos-chat-border);
    animation: hosChatSlideUp 0.25s ease-out;
    overscroll-behavior: none;
}

@keyframes hosChatSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Header ---------- */
.hos-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #064E3B 0%, #0CAE74 100%);
    color: #fff;
    flex-shrink: 0;
}

.hos-chat__header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hos-chat__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hos-chat__avatar img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.hos-chat__title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.hos-chat__subtitle {
    font-size: 11px;
    opacity: 0.85;
    line-height: 1.2;
}

.hos-chat__close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    opacity: 0.8;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hos-chat__close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

/* ---------- Messages ---------- */
.hos-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    overscroll-behavior: none;
}

.hos-chat__messages::-webkit-scrollbar {
    width: 5px;
}

.hos-chat__messages::-webkit-scrollbar-thumb {
    background: #c8d4e0;
    border-radius: 4px;
}

/* Message row */
.hos-chat__msg {
    display: flex;
    gap: 8px;
    max-width: 90%;
    animation: hosChatFadeIn 0.2s ease;
}

@keyframes hosChatFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hos-chat__msg--bot {
    align-self: flex-start;
}

.hos-chat__msg--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.hos-chat__msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--hos-chat-bot-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.hos-chat__msg-avatar img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.hos-chat__msg--user .hos-chat__msg-avatar {
    background: var(--hos-chat-primary);
    color: #fff;
}

/* Bubble */
.hos-chat__msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
}

.hos-chat__msg--bot .hos-chat__msg-bubble {
    background: var(--hos-chat-bot-bg);
    color: var(--hos-chat-text);
    border-bottom-left-radius: 4px;
}

.hos-chat__msg--user .hos-chat__msg-bubble {
    background: var(--hos-chat-user-bg);
    color: var(--hos-chat-user-text);
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.hos-chat__typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-items: center;
}

.hos-chat__typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hos-chat-primary);
    opacity: 0.4;
    animation: hosChatBounce 1.2s infinite;
}

.hos-chat__typing-dot:nth-child(2) { animation-delay: 0.15s; }
.hos-chat__typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes hosChatBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ---------- Suggestions ---------- */
.hos-chat__suggestions {
    display: flex;
    gap: 6px;
    padding: 6px 14px 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.hos-chat__suggestion {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--hos-chat-primary);
    color: var(--hos-chat-primary);
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.hos-chat__suggestion:hover {
    background: var(--hos-chat-primary);
    color: #fff;
}

/* ---------- Input ---------- */
.hos-chat__input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--hos-chat-border);
    background: #fafbfc;
    flex-shrink: 0;
}

.hos-chat__input {
    flex: 1;
    border: 1px solid var(--hos-chat-border);
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: var(--hos-chat-text);
    transition: border-color 0.15s;
}

.hos-chat__input:focus {
    border-color: var(--hos-chat-primary);
}

.hos-chat__input::placeholder {
    color: var(--hos-chat-text-muted);
}

.hos-chat__send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--hos-chat-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.hos-chat__send:hover {
    background: var(--hos-chat-primary-dark);
}

.hos-chat__send:disabled {
    background: #c8d4e0;
    cursor: not-allowed;
}

/* ---------- Footer ---------- */
.hos-chat__footer {
    padding: 6px 14px 8px;
    text-align: center;
    font-size: 10px;
    color: var(--hos-chat-text-muted);
    background: #fafbfc;
    border-top: 1px solid #f0f2f4;
    flex-shrink: 0;
}

/* ---------- Mobile responsive ---------- */
@media (max-width: 480px) {
    .hos-chat__window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        max-width: 100vw;
        border-radius: 0;
    }

    .hos-chat__toggle {
        bottom: 85px;
        right: 14px;
        left: auto;
        width: 50px;
        height: 50px;
    }

    .hos-chat__toggle-icon {
        width: 22px;
        height: 22px;
    }
}

/* ---------- Dark-mode-ready ---------- */
@media (prefers-color-scheme: dark) {
    /* Only activate if body has dark-mode class (future-proof) */
    body.dark-mode .hos-chat__window {
        --hos-chat-bg: #1a1d23;
        --hos-chat-bot-bg: #252830;
        --hos-chat-msg-bg: #252830;
        --hos-chat-text: #e4e8ec;
        --hos-chat-text-muted: #8994a5;
        --hos-chat-border: #303540;
    }
}
