/* Chatbot Container */
#uniq-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background-color: transparent !important; /* Ensure no unwanted background */
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* Chat Toggle Button (Floating Action Button) */
#uniq-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #000;
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    overflow: hidden;
    position: relative;
    padding: 0;
}

#uniq-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#uniq-chat-toggle:active {
    transform: scale(0.95);
}

#uniq-chat-toggle svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: absolute;
}

#uniq-chat-toggle.open .icon-chat {
    transform: rotate(90deg);
    opacity: 0;
}

#uniq-chat-toggle.open .icon-close {
    transform: rotate(0);
    opacity: 1;
}

#uniq-chat-toggle:not(.open) .icon-chat {
    transform: rotate(0);
    opacity: 1;
}

#uniq-chat-toggle:not(.open) .icon-close {
    transform: rotate(-90deg);
    opacity: 0;
}

/* Chat Window */
#uniq-chat-window {
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease, visibility 0.4s;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(20px);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

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

/* Chat Header */
.chat-header {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f0f0f0;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111;
    font-family: 'Playfair Display', serif; /* Matching site font */
}

.chat-header-info p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981; /* Green active color */
    border-radius: 50%;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Custom scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    animation: message-fade-in 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes message-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background-color: #000;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.bot {
    align-self: flex-start;
    background-color: #f5f5f5;
    color: #111;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

/* Input Area */
.chat-input-area {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid #e5e5e5;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
    background: #fcfcfc;
}

.chat-input:focus {
    border-color: #000;
    background: #fff;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, background-color 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background-color: #333;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.chat-send-btn svg {
    width: 18px;
    height: 18px;
    transform: translateX(1px); /* visual centering */
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background-color: #f5f5f5;
    border-radius: 16px;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-bottom: 8px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #999;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Markdown Styling within messages */
.message.bot p { margin: 0 0 8px 0; }
.message.bot p:last-child { margin: 0; }
.message.bot ul, .message.bot ol { margin: 0 0 8px 20px; padding: 0; }
.message.bot li { margin-bottom: 4px; }
.message.bot strong { font-weight: 600; }
.message.bot a { color: #000; text-decoration: underline; }

/* Responsive Adjustments */
@media (max-width: 480px) {
    #uniq-chatbot-container {
        right: 16px;
        bottom: 16px;
        z-index: 999999; /* Ensure it's on top of everything on mobile */
    }
    
    #uniq-chat-window {
        width: calc(100vw - 32px);
        height: 80vh; /* Better mobile height */
        position: absolute;
        bottom: 70px; /* Space for the toggle button */
        right: 0;
        transform-origin: bottom right;
    }
}
