/* AI Chatbot Widget Styling - Glassmorphism & Premium Brand Theme */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

#ai-chat-root {
    --primary-color: #1b4d3e;     /* Deep Forest Matcha Green */
    --accent-color: #d4af37;      /* Samurai Gold */
    --bg-light: rgba(255, 255, 255, 0.8);
    --border-light: rgba(255, 255, 255, 0.3);
    --shadow: 0 8px 32px 0 rgba(27, 77, 62, 0.15);
    
    font-family: 'Outfit', sans-serif;
    position: fixed;
    bottom: 80px;
    right: 30px;
    z-index: 999999;
}

/* Floating Toggle Button */
#ai-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #2d6a4f);
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
    position: relative;
}

#ai-chat-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 40px 0 rgba(27, 77, 62, 0.25);
    border-color: var(--accent-color);
}

.ai-toggle-icon {
    font-size: 26px;
    line-height: 1;
}
#ai-chat-toggle {
    position: fixed;
    bottom: 80px;
    right: 30px;
    z-index: 1000000;
}

.ai-chat-unread-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #e74c3c;
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Chat Window Panel */
#ai-chat-window {
    width: 380px;
    height: 420px;
    max-height: 80vh;
    border-radius: 20px;
    background: #ffffff;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    position: absolute;
    bottom: 80px;
    right: 0;
    left: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.075, 0.82, 0.165, 1);
    transform-origin: bottom right;
}

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

/* Header */
.ai-chat-header {
    background: linear-gradient(135deg, var(--primary-color), #2d6a4f);
    padding: 18px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-agent-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 1.5px solid var(--accent-color);
}

.ai-agent-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.ai-agent-status {
    font-size: 11px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-agent-status::before {
    content: "";
    width: 7px;
    height: 7px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
}

#ai-chat-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    position: absolute;
    top: 15px;
    right: 18px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

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

/* Messages Area */
#ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(255, 255, 255, 0.4);
    scroll-behavior: smooth;
}

.ai-message {
    display: flex;
    flex-direction: column;
    max-width: 82%;
}

.ai-message.ai-user {
    align-self: flex-end;
}

.ai-message.ai-bot {
    align-self: flex-start;
}

.ai-bubble {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.ai-user .ai-bubble {
    background: linear-gradient(135deg, var(--primary-color), #2d6a4f);
    color: white;
    border-radius: 16px 16px 2px 16px;
}

.ai-bot .ai-bubble {
    background: white;
    color: #2c3e50;
    border-radius: 16px 16px 16px 2px;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Form Styling (Lead Capture) */
.ai-form-container {
    background: white;
    border-radius: 14px;
    padding: 16px;
    border: 1.5px dashed var(--accent-color);
    margin-top: 10px;
    width: 100%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    box-sizing: border-box;
}

.ai-form-container h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 600;
}

.ai-form-group {
    margin-bottom: 10px;
}

.ai-form-group label {
    display: block;
    font-size: 11px;
    color: #7f8c8d;
    margin-bottom: 3px;
    font-weight: 500;
}

.ai-form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #dcdde1;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.ai-form-group input:focus {
    border-color: var(--primary-color);
}

.ai-form-submit {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.ai-form-submit:hover {
    background: #123429;
}

/* Product Card Styling */
.ai-product-recommendations {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.ai-product-card {
    background: white;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 3px 10px rgba(0,0,0,0.03);
    transition: border-color 0.2s;
}

.ai-product-card:hover {
    border-color: var(--accent-color);
}

.ai-product-title {
    font-weight: 600;
    font-size: 13px;
    color: #2c3e50;
    margin-bottom: 3px;
}

.ai-product-desc {
    font-size: 11.5px;
    color: #7f8c8d;
    line-height: 1.35;
    margin-bottom: 8px;
}

.ai-product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-product-price {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 13px;
}

.ai-product-buy {
    font-size: 11px;
    background: var(--accent-color);
    color: #1b4d3e;
    border: none;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
}

/* Typing Indicator Animation */
#ai-chat-typing {
    padding: 10px 20px;
    align-self: flex-start;
}

.ai-typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    background: white;
    padding: 10px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.03);
}

.ai-typing-dots span {
    width: 6px;
    height: 6px;
    background: #7f8c8d;
    border-radius: 50%;
    animation: aiTyping 1.4s infinite both;
}

.ai-typing-dots span:nth-child(2) { animation-delay: .2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes aiTyping {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Footer & Input Area */
.ai-chat-footer {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* Quick Replies */
.ai-quick-replies {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 8px;
    scrollbar-width: none;
}

.ai-quick-replies::-webkit-scrollbar {
    display: none;
}

.ai-qr-btn {
    white-space: nowrap;
    background: #f1f2f6;
    color: #2c3e50;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Outfit', sans-serif;
}

.ai-qr-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Input Row */
.ai-input-wrapper {
    display: flex;
    align-items: center;
    background: #f1f2f6;
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
}

#ai-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 14px;
    outline: none;
    color: #2c3e50;
    font-family: 'Outfit', sans-serif;
}

#ai-chat-send {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

#ai-chat-send:hover {
    background: var(--accent-color);
    color: var(--primary-color);
}

.ai-chat-hidden {
    display: none !important;
}

/* ── Contact Details Card ─────────────────────────────────────────── */
.ai-contact-card {
    background: linear-gradient(135deg, #1b4d3e 0%, #2d6a4f 100%);
    border-radius: 14px;
    padding: 14px 16px;
    margin: 8px 4px;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 4px 18px rgba(27,77,62,0.25);
    animation: fadeSlideIn 0.3s ease;
}

.ai-contact-header {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    letter-spacing: 0.3px;
}

.ai-contact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    line-height: 1.4;
}

.ai-contact-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.ai-contact-link {
    color: #d3f4a0;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.ai-contact-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ── Lead Capture Form ───────────────────────────────────────────── */
.ai-form-container {
    background: #fff;
    border: 1.5px solid #e8f0eb;
    border-radius: 14px;
    padding: 16px;
    margin: 8px 4px;
    box-shadow: 0 4px 20px rgba(27,77,62,0.10);
    animation: fadeSlideIn 0.3s ease;
}

.ai-form-title {
    font-weight: 600;
    font-size: 14px;
    color: #1b4d3e;
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}

.ai-form-group {
    margin-bottom: 10px;
}

.ai-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    margin-bottom: 4px;
    letter-spacing: 0.2px;
}

.ai-form-group input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #dde5e0;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Outfit', sans-serif;
    color: #2c3e50;
    background: #f9fdf9;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.ai-form-group input:focus {
    border-color: #1b4d3e;
    box-shadow: 0 0 0 3px rgba(27,77,62,0.08);
}

.ai-form-submit {
    width: 100%;
    background: linear-gradient(135deg, #1b4d3e, #2d6a4f);
    color: #fff;
    border: none;
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    margin-top: 6px;
    transition: opacity 0.2s, transform 0.15s;
    letter-spacing: 0.3px;
}

.ai-form-submit:hover:not(:disabled) {
    opacity: 0.92;
    transform: translateY(-1px);
}

.ai-form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-form-note {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin-top: 8px;
}

/* ── Fade-in animation ──────────────────────────────────────────── */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    #ai-chat-root {
        bottom: 20px;
        right: 20px;
    }
    #ai-chat-window {
        width: 320px;
        height: 380px;
        bottom: 70px;
    }
}
