:root {
    --sentientai-primary: #6366f1;
    --sentientai-header: #4f46e5;
    --sentientai-secondary: #ec4899;
    --sentientai-bg: #ffffff;
    --sentientai-text: #1f2937;
    --sentientai-text-light: #6b7280;
    --sentientai-msg-bot-bg: #f3f4f6;
    --sentientai-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --sentientai-radius: 16px;
    --sentientai-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#sentientai-chatbot-container {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    font-family: var(--sentientai-font);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
}

#sentientai-chatbot-container.sentientai-position-right {
    right: 24px;
}

#sentientai-chatbot-container.sentientai-position-left {
    left: 24px;
    right: auto;
    align-items: flex-start;
}

#sentientai-chatbot-container * {
    box-sizing: border-box;
    pointer-events: auto;
}

/* Toggle Button */
#sentientai-toggle-button {
    position: relative;
    border: none;
    background: linear-gradient(135deg, var(--sentientai-header) 0%, var(--sentientai-primary) 100%);
    color: #fff;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
}

#sentientai-toggle-button:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}

#sentientai-toggle-button:active {
    transform: scale(0.95);
}

#sentientai-toggle-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.sentientai-pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border: 2px solid var(--sentientai-primary);
    border-radius: 50%;
    animation: sentientai-pulse 2s infinite;
    opacity: 0;
    z-index: -1;
}

@keyframes sentientai-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.8);
        opacity: 0;
    }
}

/* Chat Window */
#sentientai-chat-window {
    background: #ffffff;
    border-radius: var(--sentientai-radius);
    box-shadow: var(--sentientai-shadow);
    width: 380px;
    height: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    transform: scale(1) translateY(0);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.sentientai-chatbot-hidden #sentientai-chat-window {
    opacity: 0;
    transform: scale(0.92) translateY(16px);
    pointer-events: none;
    height: 0;
    margin: 0;
    overflow: hidden;
}

/* Header */
#sentientai-chat-header {
    background: linear-gradient(135deg, var(--sentientai-header) 0%, var(--sentientai-primary) 100%);
    padding: 16px 20px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sentientai-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sentientai-status-dot {
    width: 8px;
    height: 8px;
    background-color: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    animation: sentientai-blink 2s ease-in-out infinite;
}

@keyframes sentientai-blink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.85);
    }
}

.sentientai-header-title {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sentientai-ai-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sentientai-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sentientai-header-action {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    transition: background 0.15s;
}

.sentientai-header-action:hover {
    background: rgba(255, 255, 255, 0.22);
}

#sentientai-close-button {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 18px;
    line-height: 1;
}

#sentientai-close-button:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Privacy Notice */
#sentientai-privacy-notice {
    background: #fffbeb;
    color: #92400e;
    padding: 10px 16px;
    font-size: 11px;
    line-height: 1.4;
    border-bottom: 1px solid #fcd34d;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.sentientai-privacy-link {
    color: #b45309;
    font-weight: 600;
    text-decoration: underline;
}

/* Messages Area */
#sentientai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#sentientai-messages::-webkit-scrollbar {
    width: 4px;
}

#sentientai-messages::-webkit-scrollbar-track {
    background: transparent;
}

#sentientai-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

/* Message Bubbles */
.sentientai-user,
.sentientai-bot {
    max-width: 82%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    animation: sentientai-message-in 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes sentientai-message-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sentientai-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--sentientai-primary) 0%, var(--sentientai-header) 100%);
    color: #fff;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-left: 40px;
}

.sentientai-bot {
    align-self: flex-start;
    background: #ffffff;
    color: var(--sentientai-text);
    border-radius: 16px 16px 16px 4px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-right: 40px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 18px !important;
    width: fit-content;
}

.typing-indicator span {
    display: block;
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: sentientai-typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

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

/* Input Area */
#sentientai-input-area {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#sentientai-user-input {
    flex: 1;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--sentientai-text);
    transition: all 0.2s;
    line-height: 1.4;
}

#sentientai-user-input:focus {
    outline: none;
    border-color: var(--sentientai-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#sentientai-user-input::placeholder {
    color: #6b7280;
}

#sentientai-send-button {
    background: var(--sentientai-primary);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

#sentientai-send-button:hover {
    transform: scale(1.05);
    opacity: 0.85;
}

#sentientai-send-button svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    fill: none;
    flex-shrink: 0;
}

#sentientai-send-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #sentientai-chatbot-container {
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999999;
    }

    #sentientai-chat-window {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    #sentientai-toggle-button {
        position: fixed;
        bottom: 20px;
        right: 20px;
    }

    #sentientai-chatbot-container.sentientai-position-left #sentientai-toggle-button {
        right: auto;
        left: 20px;
    }

    .sentientai-user,
    .sentientai-bot {
        max-width: 88%;
    }

    .sentientai-user {
        margin-left: 24px;
    }

    .sentientai-bot {
        margin-right: 24px;
    }
}

/* Glass Box: Confidence, Sources, Escalation */

.sentientai-msg-meta {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.sentientai-confidence {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 500;
}

.sentientai-confidence-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}

.sentientai-confidence-high {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}

.sentientai-confidence-high .sentientai-confidence-dot {
    background: #10b981;
}

.sentientai-confidence-medium {
    background: rgba(245, 158, 11, 0.08);
    color: #d97706;
}

.sentientai-confidence-medium .sentientai-confidence-dot {
    background: #f59e0b;
}

.sentientai-confidence-low {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.sentientai-confidence-low .sentientai-confidence-dot {
    background: #ef4444;
}

.sentientai-sources {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 11px;
    color: #6b7280;
    width: 100%;
}

.sentientai-sources-label {
    font-weight: 500;
}

.sentientai-source-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--sentientai-primary);
    text-decoration: none;
    padding: 1px 6px;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 4px;
    transition: background 0.15s;
    font-size: 11px;
}

.sentientai-source-link:hover {
    background: rgba(99, 102, 241, 0.12);
    text-decoration: none;
}

.sentientai-source-link svg {
    flex-shrink: 0;
}

.sentientai-escalate-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--sentientai-primary);
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.sentientai-escalate-btn:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
}

/* Empathy Engine: Sentiment Indicator */

.sentientai-sentiment {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 500;
    margin-right: 4px;
}

.sentientai-sentiment-emoji {
    font-size: 12px;
}

.sentientai-emotion-frustrated {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.sentientai-emotion-confused {
    background: rgba(245, 158, 11, 0.08);
    color: #d97706;
}

.sentientai-emotion-urgent {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.sentientai-emotion-happy {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}

/* Quick Reply Suggestions */

.sentientai-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}

.sentientai-quick-reply-chip {
    display: inline-block;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--sentientai-primary);
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.sentientai-quick-reply-chip:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.sentientai-quick-reply-chip:active {
    transform: translateY(0);
}

/* Follow-Up Suggestion Chips */

.sentientai-follow-up-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0 0;
}

.sentientai-follow-up-chip {
    display: inline-block;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--sentientai-primary);
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
    max-width: 220px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    text-align: left;
}

.sentientai-follow-up-chip:hover {
    background: var(--sentientai-primary);
    border-color: var(--sentientai-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.sentientai-follow-up-chip:active {
    transform: translateY(0);
}

/* Local Brain: Source Badges */

.sentientai-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.sentientai-source-local {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.sentientai-source-ai {
    background: rgba(99, 102, 241, 0.08);
    color: var(--sentientai-primary);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.sentientai-source-faq {
    background: rgba(245, 158, 11, 0.08);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.15);
}

#sentientai-pre-chat-form {
    position: absolute;
    inset: 0;
    background: #fff;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

#sentientai-pre-chat-form input:focus {
    border-color: var(--sentientai-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

#sentientai-pre-chat-form .error {
    border-color: #ef4444 !important;
}

#sentientai-pre-chat-form .error-msg {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
}

#sentientai-chat-window.sentientai-pre-chat-active #sentientai-messages,
#sentientai-chat-window.sentientai-pre-chat-active #sentientai-input-area {
    display: none;
}

#sentientai-canned-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
}

.sentientai-canned-btn {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
}

.sentientai-canned-btn:hover {
    border-color: var(--sentientai-primary, #6366f1);
    color: var(--sentientai-primary, #6366f1);
    background: rgba(99, 102, 241, 0.04);
}

/* Product Response Styles (SEO/AEO Optimized) */
.sentientai-woo-response {
    max-width: 95% !important;
}

.sentientai-woo-response .sentientai-msg-bubble {
    padding: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

/* Single Product Response */
.sentientai-product {
    padding: 16px;
}

.sentientai-product h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.sentientai-product .sentientai-answer {
    margin: 0 0 12px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
    color: #166534;
}

.sentientai-product .sentientai-details {
    margin: 0 0 12px;
}

.sentientai-product .sentientai-details p {
    margin: 4px 0;
    font-size: 13px;
}

.sentientai-product .sentientai-attributes {
    margin: 8px 0;
    padding-left: 20px;
}

.sentientai-product .sentientai-attributes li {
    margin: 4px 0;
    font-size: 13px;
}

/* Multi-Product List Response */
.sentientai-product-list {
    padding: 16px;
}

.sentientai-product-list h3 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.sentientai-product-list-items {
    margin: 0;
    padding-left: 24px;
}

.sentientai-product-list-items li {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.5;
}

.sentientai-product-list-items a {
    color: var(--sentientai-primary, #6366f1);
    text-decoration: none;
    font-weight: 500;
}

.sentientai-product-list-items a:hover {
    text-decoration: underline;
}

/* Comparison Response */
.sentientai-comparison {
    padding: 16px;
}

.sentientai-comparison h3 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.sentientai-comparison .sentientai-answer {
    margin: 0 0 12px;
    padding: 8px 12px;
    background: #f0f9ff;
    border-left: 3px solid #3b82f6;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
    color: #1e40af;
}

.sentientai-comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 16px;
    font-size: 13px;
}

.sentientai-comparison-table th,
.sentientai-comparison-table td {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    text-align: left;
}

.sentientai-comparison-table th {
    background: #f1f5f9;
    font-weight: 600;
    color: #334155;
}

.sentientai-comparison-table .best-value {
    background: #f0fdf4;
    font-weight: 500;
    color: #166534;
}

.sentientai-comparison-links {
    margin-top: 12px;
}

.sentientai-comparison-links a {
    color: var(--sentientai-primary, #6366f1);
    text-decoration: none;
    font-weight: 500;
}

.sentientai-comparison-links a:hover {
    text-decoration: underline;
}

/* No Results */
.sentientai-no-results {
    padding: 16px;
    text-align: center;
    color: #64748b;
    font-style: italic;
}
