/* Modern Figurative AI Chat Sidebar */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Main Container - Widget Only */
.figurative-ai-chat {
    background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
    border-radius: 16px;
    border: 1px solid rgba(0, 113, 220, 0.08);
    box-shadow: 
        0 8px 32px rgba(0, 51, 102, 0.1),
        0 2px 16px rgba(0, 113, 220, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #1a202c;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    max-width: none;
    max-height: 650px;
    min-height: 480px;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}


/* Widget-specific adjustments */
.figurative-ai-chat-widget {
    position: relative;
}


/* Shortcode wrapper styles */
.figurative-ai-chat-shortcode-wrapper {
    margin: 16px 0;
}


.figurative-ai-chat-shortcode-wrapper .figurative-ai-chat-title {
    margin: 0 0 12px 0;
    padding: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    border-bottom: 2px solid rgba(0, 113, 220, 0.1);
    padding-bottom: 6px;
}


/* Widget header adjustments */
.figurative-ai-chat-widget .ai-chat-header {
    padding: 18px 18px 14px;
}


.figurative-ai-chat-widget .ai-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
}


.figurative-ai-chat-widget .ai-chat-title {
    font-size: 15px;
}


.figurative-ai-chat-widget .ai-chat-subtitle {
    font-size: 11px;
}


/* Widget body adjustments */
.figurative-ai-chat-widget .ai-chat-body {
    padding: 18px;
    gap: 12px;
}


.figurative-ai-chat-widget .ai-chat-messages {
    max-height: 380px;
    min-height: 240px;
}


/* Widget composer adjustments */
.figurative-ai-chat-widget .ai-chat-composer {
    padding: 16px 18px 18px;
}


.figurative-ai-chat-widget .ai-chat-composer textarea {
    min-height: 44px;
    padding: 10px 12px;
}


.figurative-ai-chat-widget .ai-chat-send {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 12px;
}


/* Collapsed state removed - widget-only version */

.figurative-ai-chat.is-disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Header Section */
.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 16px;
    background: linear-gradient(135deg, #0071dc 0%, #3498ff 100%);
    position: relative;
    overflow: hidden;
}


.ai-chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.ai-chat-identity {
    display: flex;
    gap: 16px;
    align-items: center;
    position: relative;
    z-index: 1;
}
.ai-chat-avatar {
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    font-size: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 16px rgba(0, 51, 102, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.ai-chat-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.ai-chat-subtitle {
    margin: 0;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.3;
}
.ai-chat-toggle {
    display: none !important;
}


.ai-chat-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
}

/* Body Section */
.ai-chat-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 20px 18px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 113, 220, 0.2) transparent;
}


.ai-chat-body::-webkit-scrollbar {
    width: 4px;
}

.ai-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 113, 220, 0.2);
    border-radius: 2px;
}

.ai-chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 113, 220, 0.3);
}

/* Messages */
.ai-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: 450px;
    min-height: 280px;
    padding-right: 6px;
    margin-right: -6px;
}
.ai-chat-message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}


@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-message.ai-chat-user {
    align-items: flex-end;
}

.ai-chat-message.ai-chat-user .ai-chat-bubble {
    background: linear-gradient(135deg, #0071dc 0%, #3498ff 100%);
    color: #ffffff;
    border-top-right-radius: 8px;
    box-shadow: 
        0 4px 16px rgba(0, 113, 220, 0.25),
        0 1px 4px rgba(0, 113, 220, 0.1);
}

.ai-chat-message.ai-chat-assistant .ai-chat-bubble {
    background: #ffffff;
    border: 1px solid rgba(0, 113, 220, 0.08);
    color: #2d3748;
    border-top-left-radius: 8px;
    box-shadow: 
        0 4px 16px rgba(0, 51, 102, 0.06),
        0 1px 4px rgba(0, 113, 220, 0.04);
}

.ai-chat-badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #0071dc;
    margin: 0;
}
.ai-chat-bubble {
    padding: 12px 16px;
    border-radius: 20px;
    line-height: 1.45;
    font-size: 13px;
    font-weight: 400;
    max-width: 260px;
    word-wrap: break-word;
    position: relative;
}


.ai-chat-message.is-highlighted .ai-chat-bubble {
    border: 1px solid #3498ff;
    box-shadow: 
        0 8px 32px rgba(52, 152, 255, 0.15),
        0 2px 8px rgba(52, 152, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: scale(1.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Typing Animation */
.ai-chat-message.is-typing .ai-chat-bubble {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 16px 20px;
}

.ai-typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3498ff;
    animation: ai-typing 1.4s infinite ease-in-out;
}

.ai-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes ai-typing {
    0%, 80%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-6px);
    }
}

/* Composer Section */
.ai-chat-composer {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 18px 20px 20px;
    border-top: 1px solid rgba(0, 113, 220, 0.08);
    background: 
        linear-gradient(to bottom, rgba(248, 251, 255, 0.8), rgba(255, 255, 255, 0.9)),
        rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.ai-chat-composer textarea {
    flex: 1;
    border: 1px solid rgba(0, 113, 220, 0.15);
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    overflow-y: hidden;
    max-height: none;
    background: rgba(255, 255, 255, 0.9);
    color: #2d3748;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.45;
    box-sizing: border-box;
}
.ai-chat-expand {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 14px;
    border: 1px solid rgba(0, 113, 220, 0.15);
    background: rgba(0, 113, 220, 0.08);
    color: #0071dc;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 6px 20px rgba(0, 113, 220, 0.16),
        0 2px 8px rgba(0, 113, 220, 0.08);
    user-select: none;
}

.ai-chat-expand.is-visible {
    display: flex;
}

.ai-chat-expand:hover {
    background: rgba(0, 113, 220, 0.12);
    transform: translateY(-1px);
    box-shadow:
        0 8px 24px rgba(0, 113, 220, 0.22),
        0 3px 12px rgba(0, 113, 220, 0.12);
}

.ai-chat-expand:active {
    transform: translateY(0);
    box-shadow:
        0 4px 16px rgba(0, 113, 220, 0.16),
        0 2px 6px rgba(0, 113, 220, 0.08);
}

.ai-chat-expand:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(52, 152, 255, 0.2),
        0 8px 24px rgba(0, 113, 220, 0.22);
}

.figurative-ai-chat.is-composer-expanded .ai-chat-composer {
    align-items: flex-start;
}

.figurative-ai-chat.is-composer-expanded .ai-chat-composer textarea {
    min-height: 200px;
    box-shadow:
        0 0 0 3px rgba(52, 152, 255, 0.12),
        0 12px 28px rgba(0, 113, 220, 0.16);
}





.ai-chat-composer textarea::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

.ai-chat-composer textarea:focus {
    outline: none;
    border-color: #3498ff;
    background: rgba(255, 255, 255, 1);
    box-shadow: 
        0 0 0 3px rgba(52, 152, 255, 0.1),
        0 4px 16px rgba(0, 113, 220, 0.08);
    transform: translateY(-1px);
}
.ai-chat-send {
    border: none;
    border-radius: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0071dc 0%, #3498ff 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    min-width: 72px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 4px 16px rgba(0, 113, 220, 0.25),
        0 1px 4px rgba(0, 113, 220, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}



.ai-chat-send::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.ai-chat-send:hover::before {
    left: 100%;
}

.ai-chat-send:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 32px rgba(0, 113, 220, 0.3),
        0 4px 16px rgba(0, 113, 220, 0.15);
}

.ai-chat-send:active {
    transform: translateY(0);
}

.figurative-ai-chat.is-sending .ai-chat-send {
    opacity: 0.8;
    cursor: wait;
    background: linear-gradient(135deg, #718096 0%, #a0aec0 100%);
}

/* Cursor Tip */
.ai-chat-cursor-tip {
    position: fixed;
    pointer-events: none;
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    max-width: 280px;
    box-shadow: 
        0 16px 32px rgba(45, 55, 72, 0.2),
        0 4px 16px rgba(45, 55, 72, 0.1);
    backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    z-index: 99999;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-cursor-tip.is-visible {
    opacity: 1;
    transform: translateY(-4px);
}

.ai-chat-cursor-tip.is-hidden {
    opacity: 0;
    transform: translateY(0);
}

/* Widget responsive adjustments for narrow sidebars */
@media (max-width: 300px) {
    .figurative-ai-chat-widget .ai-chat-header {
        padding: 16px;
    }

    .figurative-ai-chat-widget .ai-chat-body {
        padding: 16px;
        gap: 12px;
    }

    .figurative-ai-chat-widget .ai-chat-composer {
        padding: 12px 16px 16px;
        gap: 8px;
    }

    .figurative-ai-chat-widget .ai-chat-composer textarea {
        min-height: 44px;
        font-size: 13px;
    }

    .figurative-ai-chat-widget .ai-chat-send {
        min-height: 40px;
        padding: 10px 16px;
        font-size: 12px;
        min-width: 60px;
    }

    .figurative-ai-chat-widget .ai-chat-identity {
        gap: 12px;
    }

    .figurative-ai-chat-widget .ai-chat-avatar {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .figurative-ai-chat-widget .ai-chat-title {
        font-size: 14px;
    }

    .figurative-ai-chat-widget .ai-chat-subtitle {
        font-size: 11px;
    }

    .figurative-ai-chat-widget .ai-chat-bubble {
        padding: 12px 14px;
        font-size: 13px;
    }

}

/* Widget responsive design only */
@media (max-width: 768px) {
    .figurative-ai-chat-widget .ai-chat-body {
        padding: 16px;
    }

    .figurative-ai-chat-widget .ai-chat-composer {
        padding: 12px 16px 16px;
    }

    .figurative-ai-chat-widget .ai-chat-messages {
        max-height: 350px;
        min-height: 220px;
    }
}

@media (max-width: 480px) {
    .figurative-ai-chat-widget .ai-chat-header {
        padding: 16px;
    }

    .figurative-ai-chat-widget .ai-chat-body {
        padding: 12px;
        gap: 12px;
    }

    .figurative-ai-chat-widget .ai-chat-composer {
        padding: 12px;
    }

    .figurative-ai-chat-widget .ai-chat-bubble {
        max-width: none;
        padding: 12px 14px;
        font-size: 13px;
    }

    .figurative-ai-chat-widget .ai-chat-expand {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 16px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .figurative-ai-chat {
        background: linear-gradient(145deg, #1a202c 0%, #2d3748 100%);
        border-color: rgba(255, 255, 255, 0.1);
        color: #e2e8f0;
    }

    .ai-chat-message.ai-chat-assistant .ai-chat-bubble {
        background: #2d3748;
        border-color: rgba(255, 255, 255, 0.1);
        color: #e2e8f0;
    }


    .ai-chat-composer {
        background: rgba(45, 55, 72, 0.8);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .ai-chat-composer textarea {
        background: rgba(45, 55, 72, 0.9);
        border-color: rgba(255, 255, 255, 0.1);
        color: #e2e8f0;
    }

    .ai-chat-expand {
        background: rgba(0, 113, 220, 0.3);
        border-color: rgba(0, 113, 220, 0.45);
        color: #f7fafc;
        box-shadow:
            0 6px 20px rgba(0, 113, 220, 0.32),
            0 2px 10px rgba(0, 0, 0, 0.3);
    }

    .ai-chat-expand:hover {
        background: rgba(0, 113, 220, 0.4);
    }

    .ai-chat-expand:focus-visible {
        box-shadow:
            0 0 0 3px rgba(52, 152, 255, 0.35),
            0 10px 28px rgba(0, 113, 220, 0.32);
    }

    .figurative-ai-chat.is-composer-expanded .ai-chat-composer textarea {
        box-shadow:
            0 0 0 3px rgba(52, 152, 255, 0.18),
            0 12px 28px rgba(0, 113, 220, 0.28);
    }


    .ai-chat-composer textarea::placeholder {
        color: #718096;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .figurative-ai-chat,
    .ai-chat-bubble,
    .ai-chat-send,
    .ai-chat-composer textarea,
    .ai-chat-expand,
    .ai-chat-toggle {
        transition: none;
    }

    .ai-typing-dot {
        animation: none;
    }

    @keyframes messageSlideIn {
        from, to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .figurative-ai-chat {
        border-width: 2px;
    }

    .ai-chat-message.ai-chat-assistant .ai-chat-bubble {
        border-width: 2px;
    }


    .ai-chat-composer textarea {
        border-width: 2px;
    }
}

@media (min-width: 768px) {
    .figurative-ai-chat-widget,
    .figurative-ai-chat-shortcode-wrapper {
        position: sticky;
        top: 24px;
        z-index: 5;
    }
}











