/**
 * gd_chatbot.css - Premium AI Agent Styles
 * Grayscale, Minimalist, Business-agnostic
 */

:root {
    --gd-chat-primary: #1F2937;      /* Dark Gray Premium */
    --gd-chat-primary-dark: #111827; /* Near Black */
    --gd-chat-bg: #ffffff;
    --gd-chat-text: #374151;
    --gd-chat-muted: #9CA3AF;
    --gd-chat-border: #E5E7EB;
    --gd-chat-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15), 0 10px 20px -5px rgba(0, 0, 0, 0.08);
}

/* Floating Button */
#gd-chatbot-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gd-chat-primary);
    color: white;
    border: none;
    box-shadow: var(--gd-chat-shadow);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, background 0.3s ease;
}

#gd-chatbot-trigger:hover {
    transform: scale(1.05) translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: var(--gd-chat-primary-dark);
}

#gd-chatbot-trigger svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

#gd-chatbot-trigger.is-open svg {
    transform: rotate(90deg) scale(0);
    opacity: 0;
}

#gd-chatbot-trigger .gd-close-icon {
    position: absolute;
    transform: rotate(-90deg) scale(0);
    opacity: 0;
}

#gd-chatbot-trigger.is-open .gd-close-icon {
    transform: rotate(0) scale(1);
    opacity: 1;
}

/* Chat Window */
.gd-chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--gd-chat-bg);
    border-radius: 20px;
    box-shadow: var(--gd-chat-shadow);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--gd-chat-border);
}

.gd-chatbot-window.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.gd-chat-header {
    background: var(--gd-chat-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.gd-chat-header-info {
    flex: 1;
}

.gd-chat-header-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.gd-chat-header-subtitle {
    font-size: 11px;
    opacity: 0.7;
    margin: 4px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gd-chat-close-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}
.gd-chat-close-btn:hover {
    color: white;
}

/* Chat Messages Area */
.gd-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #FAFAFA;
}

/* Message Bubbles */
.gd-message {
    max-width: 85%;
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    animation: gd-msg-pop 0.3s ease forwards;
    transform-origin: bottom left;
}

@keyframes gd-msg-pop {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.gd-message.user {
    align-self: flex-end;
    background: var(--gd-chat-primary);
    color: white;
    border-radius: 18px 18px 4px 18px;
    transform-origin: bottom right;
}

.gd-message.bot {
    align-self: flex-start;
    background: white;
    color: var(--gd-chat-text);
    border: 1px solid var(--gd-chat-border);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

/* CTA Buttons dynamically added by the bot */
.gd-chat-cta {
    display: block;
    text-align: center;
    padding: 12px;
    margin-top: 8px;
    background: var(--gd-chat-primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s ease;
}
.gd-chat-cta:hover {
    background: var(--gd-chat-primary-dark);
}

/* Chat Input Area */
.gd-chat-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid var(--gd-chat-border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.gd-chat-input-wrapper {
    flex: 1;
    background: #F3F4F6;
    border-radius: 24px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    border: 1px solid transparent;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.gd-chat-input-wrapper:focus-within {
    background: white;
    border-color: var(--gd-chat-muted);
}

.gd-chat-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 14px;
    color: var(--gd-chat-text);
    resize: none;
    max-height: 100px;
    min-height: 20px;
    outline: none;
    font-family: inherit;
}

.gd-chat-send-btn {
    background: var(--gd-chat-primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.gd-chat-send-btn:hover:not(:disabled) {
    background: var(--gd-chat-primary-dark);
    transform: scale(1.05);
}

.gd-chat-send-btn:disabled {
    background: var(--gd-chat-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Typing Indicator */
.gd-typing {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    align-items: center;
}

.gd-typing-dot {
    width: 6px;
    height: 6px;
    background: var(--gd-chat-muted);
    border-radius: 50%;
    animation: gd-typing-bounce 1.4s infinite ease-in-out both;
}

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

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

/* Responsive */
@media (max-width: 480px) {
    .gd-chatbot-window {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    #gd-chatbot-trigger.is-open {
        display: none;
    }
}
