/* BluetechGreen AI Chat Widget */

.chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--ac, #0B6E4F);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(11, 110, 79, 0.3);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9999;
}

.chat-bubble:hover {
    background: var(--ah, #094D38);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(11, 110, 79, 0.4);
}

.chat-bubble svg {
    width: 24px;
    height: 24px;
    fill: #FFFFFF;
}

.chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 500px;
    background: var(--bgc, #FFFFFF);
    border-radius: var(--r, 12px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9998;
    overflow: hidden;
}

.chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-header {
    background: linear-gradient(135deg, var(--bl, #1B4965), var(--ac, #0B6E4F));
    color: #FFFFFF;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--r, 12px) var(--r, 12px) 0 0;
    flex-shrink: 0;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-logo {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.chat-header-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #FFFFFF;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chat-close svg {
    width: 14px;
    height: 14px;
    fill: #FFFFFF;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bgw, #F5F3EE);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--bd, #E5E2DB);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--tm, #7A7A7A);
}

.chat-msg {
    display: flex;
    gap: 8px;
    animation: slideIn 0.3s ease;
}

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

.chat-msg.user {
    flex-direction: row-reverse;
}

.chat-msg-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: var(--r, 12px);
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-msg.user .chat-msg-content {
    background: var(--bl, #1B4965);
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

.chat-msg.bot .chat-msg-content {
    background: #FFFFFF;
    color: var(--tp, #1A1A1A);
    border: 1px solid var(--bd, #E5E2DB);
    border-bottom-left-radius: 4px;
}

.chat-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 10px 14px;
    background: #FFFFFF;
    border: 1px solid var(--bd, #E5E2DB);
    border-radius: var(--r, 12px);
    border-bottom-left-radius: 4px;
    max-width: 75%;
}

.chat-typing span {
    width: 6px;
    height: 6px;
    background: var(--tm, #7A7A7A);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.chat-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

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

.chat-input-wrap {
    padding: 16px 20px;
    background: var(--bgc, #FFFFFF);
    border-top: 1px solid var(--bd, #E5E2DB);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    border: 1.5px solid var(--bd, #E5E2DB);
    border-radius: var(--rs, 8px);
    padding: 10px 12px;
    font-size: 0.9rem;
    font-family: var(--f, 'DM Sans', -apple-system, sans-serif);
    color: var(--tp, #1A1A1A);
    transition: border-color 0.2s ease;
    outline: none;
}

.chat-input:focus {
    border-color: var(--ac, #0B6E4F);
}

.chat-input::placeholder {
    color: var(--tm, #7A7A7A);
}

.chat-send {
    width: 40px;
    height: 40px;
    background: var(--ac, #0B6E4F);
    border: none;
    border-radius: var(--rs, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send:hover:not(:disabled) {
    background: var(--ah, #094D38);
    transform: translateY(-1px);
}

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

.chat-send svg {
    width: 18px;
    height: 18px;
    fill: #FFFFFF;
}

@media (max-width: 768px) {
    .chat-bubble {
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
    }

    .chat-bubble svg {
        width: 22px;
        height: 22px;
    }

    .chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: calc(100vh - var(--nh, 72px));
        border-radius: 0;
        transform: translateY(100%);
    }

    .chat-window.open {
        transform: translateY(0);
    }

    .chat-header {
        border-radius: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-bubble,
    .chat-window,
    .chat-msg {
        animation: none;
        transition: none;
    }

    .chat-typing span {
        animation: none;
    }
}
