/* Chat Widget CSS */
#hibiscus-chat-widget {
    font-family: 'Inter', sans-serif;
    z-index: 9999;
}

/* Toggle Button */
.chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
}

.chat-toggle-btn.hidden {
    display: none;
}

/* Chat Window */
#chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 10000;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

#chat-window.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

#chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
}

#close-chat {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 4px;
}

#close-chat:hover {
    opacity: 1;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    text-align: left;
}

.message a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
}

.dark .message a {
    color: #60a5fa;
}

.bot-message {
    background-color: white;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.user-message {
    background-color: #2563eb;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

/* Input Area */
.chat-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #2563eb;
}

#send-message {
    background: #2563eb;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

#send-message:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

#send-message:active {
    transform: scale(0.95);
}

/* Loading Animation */
.loading .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #9ca3af;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Dark Mode Support */
.dark #chat-window {
    background: #1f2937;
    border-color: #374151;
}

.dark .chat-messages {
    background-color: #111827;
}

.dark .bot-message {
    background-color: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
}

.dark .chat-input-area {
    background: #1f2937;
    border-color: #374151;
}

.dark #chat-input {
    background: #374151;
    border-color: #4b5563;
    color: white;
}

.dark #chat-input:focus {
    border-color: #3b82f6;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chat-toggle-btn {
        bottom: 16px;
        right: 16px;
    }
}