/* ===========================
   Chatbot Widget Styles
   =========================== */

/* Floating toggle button — hidden by default, shown when chatbot service is available */
.chatbot-toggle {
    display: none;
    position: fixed;
    bottom: 15px;
    right: 15px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0051a5;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 81, 165, 0.35);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: chatbot-nudge 3s ease-in-out infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 81, 165, 0.45);
    animation: none;
}

/* Antenna dots glow red on hover — candle-like effect */
.chatbot-toggle .antenna-dot {
    transition: fill 0.3s ease;
}
.chatbot-toggle .antenna-glow {
    transition: opacity 0.3s ease;
}
.chatbot-toggle:hover .antenna-dot {
    fill: #fff;
}
.chatbot-toggle:hover .antenna-glow {
    opacity: 1;
}

.chatbot-toggle.active {
    animation: none;
}

@keyframes chatbot-nudge {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(0); }
    55% { transform: translateX(-5px); }
    70% { transform: translateX(0); }
}

.chatbot-toggle svg {
    width: 32px;
    height: 32px;
}
.chatbot-toggle .chatbot-icon-close {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.chatbot-toggle .chatbot-icon-close svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.chatbot-end-label {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0;
}

.chatbot-toggle.active .chatbot-icon-chat {
    display: none;
}

.chatbot-toggle.active .chatbot-icon-close {
    display: flex;
}

/* Chat panel */
.chatbot-panel {
    position: fixed;
    bottom: 15px;
    right: 78px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-panel.open {
    display: flex;
}

/* Header */
.chatbot-header {
    background: #0051a5;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.chatbot-header-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header-icon svg {
    width: 20px;
    height: 20px;
}

.chatbot-header {
    justify-content: flex-start;
}

.chatbot-reset-btn {
    margin-left: auto;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 4px 10px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.chatbot-reset-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.chatbot-header-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.chatbot-header-subtitle {
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.3;
}

/* Messages area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f5f7fa;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 2px;
}

/* Message bubbles */
.chatbot-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: chatbot-fade-in 0.2s ease;
}

@keyframes chatbot-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-msg--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-msg--assistant {
    align-self: flex-start;
}

.chatbot-msg-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.chatbot-msg--user .chatbot-msg-bubble {
    background: #0051a5;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chatbot-msg--assistant .chatbot-msg-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Markdown-like styling inside assistant messages */
.chatbot-msg--assistant .chatbot-msg-bubble strong {
    font-weight: 600;
}

.chatbot-msg--assistant .chatbot-msg-bubble ul,
.chatbot-msg--assistant .chatbot-msg-bubble ol {
    margin: 4px 0;
    padding-left: 18px;
}

.chatbot-msg--assistant .chatbot-msg-bubble li {
    margin-bottom: 2px;
}

.chatbot-msg--assistant .chatbot-msg-bubble a {
    color: #0051a5;
    text-decoration: underline;
}

/* Typing indicator */
.chatbot-typing {
    display: none;
    align-self: flex-start;
    padding: 10px 14px;
    background: #fff;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    animation: chatbot-fade-in 0.2s ease;
}

.chatbot-typing.visible {
    display: flex;
    align-items: center;
}

.chatbot-typing-text {
    font-size: 12.5px;
    color: #555;
    font-weight: 500;
    white-space: nowrap;
    animation: chatbot-typing-pulse 1.5s ease-in-out infinite;
}

@keyframes chatbot-typing-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Input area */
.chatbot-input-area {
    padding: 12px 16px 6px;
    border-top: 1px solid #eee;
    background: #fff;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 80px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    line-height: 1.4;
    font-family: inherit;
}

.chatbot-input::-webkit-scrollbar {
    display: none;
}

.chatbot-input:focus {
    border-color: #0051a5;
}

.chatbot-input::placeholder {
    color: #aaa;
}

.chatbot-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #0051a5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.chatbot-send-btn:hover {
    background: #003d7a;
}

.chatbot-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chatbot-send-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.chatbot-char-count {
    font-size: 11px;
    color: #999;
    text-align: right;
    padding: 0 16px;
    background: #f5f7fa;
    flex-shrink: 0;
}

.chatbot-char-count.over-limit {
    color: #e53935;
}

.chatbot-disclaimer {
    font-size: 10px;
    color: #999;
    text-align: center;
    padding: 0 16px 8px;
    background: #fff;
    flex-shrink: 0;
    line-height: 1.3;
}

/* Header close button - hidden on desktop, shown on mobile */
.chatbot-close-btn {
    display: none;
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .chatbot-panel {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chatbot-toggle.active {
        display: none;
    }

    .chatbot-close-btn {
        display: flex;
    }

    .chatbot-reset-btn {
        margin-left: 0;
    }
}
