:root {
    --sentientai-primary: #6366f1;
    /* Indigo 500 */
    --sentientai-primary-dark: #4f46e5;
    /* Indigo 600 */
    --sentientai-secondary: #ec4899;
    /* Pink 500 */
    --sentientai-bg: #ffffff;
    --sentientai-text: #1f2937;
    /* Gray 900 */
    --sentientai-text-light: #6b7280;
    /* Gray 500 */
    --sentientai-msg-bot-bg: #f3f4f6;
    /* Gray 100 */
    --sentientai-msg-user-bg: linear-gradient(135deg, var(--sentientai-primary) 0%, var(--sentientai-secondary) 100%);
    --sentientai-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --sentientai-radius: 20px;
    --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;
    /* Allow clicking through the container area */
}

#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;
    /* Re-enable pointer events for children */
}

/* Toggle Button */
#sentientai-toggle-button {
    position: relative;
    border: none;
    background: var(--sentientai-msg-user-bg);
    color: #fff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
}

#sentientai-toggle-button:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

#sentientai-toggle-button svg {
    width: 28px;
    height: 28px;
    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: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    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.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    transform: scale(1) translateY(0);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.sentientai-chatbot-hidden #sentientai-chat-window {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
    height: 0;
    /* Collapse height to avoid blocking clicks */
    margin: 0;
    overflow: hidden;
}

/* Header */
#sentientai-chat-header {
    background: var(--sentientai-msg-user-bg);
    padding: 20px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.sentientai-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sentientai-status-dot {
    width: 10px;
    height: 10px;
    background-color: #34d399;
    /* Emerald 400 */
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
    animation: sentientai-blink 3s infinite;
}

@keyframes sentientai-blink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(0.9);
    }
}

.sentientai-header-title {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.sentientai-ai-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
}

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

.sentientai-header-action {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

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

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

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

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

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

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

/* Scrollbar */
#sentientai-messages::-webkit-scrollbar {
    width: 6px;
}

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

#sentientai-messages::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 3px;
}

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

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sentientai-user {
    align-self: flex-end;
    background: var(--sentientai-msg-user-bg);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.sentientai-bot {
    align-self: flex-start;
    background: var(--sentientai-msg-bot-bg);
    color: var(--sentientai-text);
    border-radius: 18px 18px 18px 4px;
    border: 1px solid #f3f4f6;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px 20px !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: 16px;
    background: #fff;
    border-top: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 10px;
}

#sentientai-user-input {
    flex: 1;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 14px 20px;
    font-size: 15px;
    color: var(--sentientai-text);
    transition: all 0.2s;
}

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

#sentientai-send-button {
    background: var(--sentientai-msg-user-bg);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}

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

#sentientai-send-button:disabled {
    opacity: 0.6;
    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;
    }

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

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