/**
 * HHSC AI Chat Widget Styles
 */
.hhsc-ai-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--hhsc-ai-color, #0d3b66);
    background: #fff;
    color: var(--hhsc-ai-color, #0d3b66);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background-color 0.2s, color 0.2s;
}
.hhsc-ai-bubble:hover,
.hhsc-ai-bubble:focus-visible {
    background: var(--hhsc-ai-color, #0d3b66);
    color: #fff;
    transform: scale(1.08);
}
.hhsc-ai-bubble:focus-visible {
    outline: 3px solid #f0b429;
    outline-offset: 3px;
}
.hhsc-ai-bubble-icon {
    width: 30px;
    height: 30px;
    display: block;
    pointer-events: none;
}

.hhsc-ai-window {
    position: fixed;
    bottom: 92px;
    right: 24px;
    z-index: 99999;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.hhsc-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #0d3b66;
    color: #fff;
    flex-shrink: 0;
}
.hhsc-ai-header-title { font-weight: 600; font-size: 15px; }
.hhsc-ai-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.hhsc-ai-close:hover { opacity: 0.7; }

.hhsc-ai-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f8fa;
}

.hhsc-ai-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.hhsc-ai-msg-user {
    align-self: flex-end;
    background: #0d3b66;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.hhsc-ai-msg-bot {
    align-self: flex-start;
    background: #fff;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.hhsc-ai-thinking {
    color: #888;
    font-style: italic;
}

/* Bot message formatting */
.hhsc-ai-msg-bot b, .hhsc-ai-msg-bot strong {
    color: #0d3b66;
    font-weight: 600;
}
.hhsc-ai-msg-bot b[style] {
    color: inherit;
}
.hhsc-ai-msg-bot br {
    display: inline;
}
.hhsc-ai-msg-bot hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 8px 0;
}
.hhsc-ai-msg-bot ul,
.hhsc-ai-msg-bot ol {
    margin: 6px 0;
    padding-left: 20px;
}
.hhsc-ai-msg-bot li {
    margin: 3px 0;
}

.hhsc-ai-input-wrap {
    display: flex;
    padding: 12px;
    gap: 8px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}
.hhsc-ai-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.hhsc-ai-input:focus { border-color: #0d3b66; }
.hhsc-ai-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}
.hhsc-ai-send:disabled { opacity: 0.4; cursor: default; }

/* Typewriter cursor animation */
.hhsc-ai-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #0d3b66;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: hhsc-blink 0.7s infinite;
}
@keyframes hhsc-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Typing indicator (three bouncing dots) */
.hhsc-ai-typing {
    display: flex;
    align-items: center;
    min-height: 30px;
}
.hhsc-ai-typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.hhsc-ai-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #999;
    animation: hhsc-bounce 1.2s infinite ease-in-out;
}
.hhsc-ai-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.hhsc-ai-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes hhsc-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 480px) {
    .hhsc-ai-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .hhsc-ai-bubble { bottom: 16px; right: 16px; }
}
