/* ── Chatbot Widget ─────────────────────────────────── */

/* Tooltip bubble */
.chatbot-tooltip {
    position: fixed !important;
    bottom: 170px !important;
    right: 28px !important;
    background: #fff;
    color: #333;
    padding: 10px 14px 10px 12px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2000 !important;
    opacity: 0;
    transform: translateY(6px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
    border: 1px solid #e8f5e9;
    cursor: pointer;
}

.chatbot-tooltip--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chatbot-tooltip::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 23px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-right: 1px solid #e8f5e9;
    border-bottom: 1px solid #e8f5e9;
    transform: rotate(45deg);
}

.chatbot-tooltip-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
    line-height: 1;
    margin-left: 2px;
}

.chatbot-tooltip-close:hover {
    color: #555;
}

/* FAB button */
.chatbot-fab {
    position: fixed !important;
    bottom: 92px !important;
    right: 28px !important;
    width: 58px;
    height: 58px;
    background: #2e7d32;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(46,125,50,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    transition: background 0.2s, transform 0.2s;
    animation: chatbot-pulse 2.5s ease-in-out 4s 3;
}

@keyframes chatbot-pulse {
    0%   { box-shadow: 0 4px 16px rgba(46,125,50,0.4); transform: scale(1); }
    50%  { box-shadow: 0 4px 28px rgba(46,125,50,0.7); transform: scale(1.1); }
    100% { box-shadow: 0 4px 16px rgba(46,125,50,0.4); transform: scale(1); }
}

.chatbot-fab:hover {
    background: #1b5e20;
    transform: scale(1.08);
}

.chatbot-fab svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}

/* Notification badge */
.chatbot-fab-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: #e53935;
    color: #fff;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: badge-pop 0.4s ease 1s both;
}

@keyframes badge-pop {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.chatbot-window {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
}

.chatbot-window.chatbot-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
}

.chatbot-header {
    background: #2e7d32;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.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;
    flex-shrink: 0;
}

.chatbot-header-icon svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.chatbot-header-text {
    flex: 1;
}

.chatbot-header-text strong {
    display: block;
    font-size: 0.95rem;
}

.chatbot-status {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chatbot-status-dot {
    width: 7px;
    height: 7px;
    background: #a5d6a7;
    border-radius: 50%;
    display: inline-block;
    animation: status-blink 2s ease-in-out infinite;
}

@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.chatbot-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    font-size: 1.2rem;
    line-height: 1;
}

.chatbot-close:hover {
    opacity: 1;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 260px;
    max-height: 340px;
    background: #f9f9f9;
}

.chatbot-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    word-break: break-word;
}

.chatbot-msg--bot {
    background: #fff;
    border: 1px solid #e0e0e0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: #333;
}

.chatbot-msg--user {
    background: #2e7d32;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chatbot-msg--typing {
    background: #fff;
    border: 1px solid #e0e0e0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: #999;
    font-style: italic;
}

.chatbot-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #eee;
    background: #fff;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #2e7d32;
}

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

.chatbot-send:hover {
    background: #1b5e20;
}

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

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-powered {
    text-align: center;
    font-size: 0.72rem;
    color: #aaa;
    padding: 6px 0 10px;
    background: #fff;
}

/* Quick-question suggestion chips */
.chatbot-suggestions {
    margin-top: 4px;
}

.chatbot-suggestions-label {
    font-size: 0.75rem;
    color: #888;
    margin: 0 0 7px 2px;
}

.chatbot-chip {
    display: inline-block;
    background: #f1f8f1;
    border: 1px solid #c8e6c9;
    color: #2e7d32;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    margin: 0 5px 6px 0;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.chatbot-chip:hover {
    background: #e8f5e9;
    border-color: #2e7d32;
}

/* Typing dots indicator */
.chatbot-typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: #eef5ee;
    border-radius: 12px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #1a6b2a;
    border-radius: 50%;
    display: inline-block;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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