:root {
    --ai-bot-bg: var(--glass);
    --ai-bot-border: var(--glass-border);
    --ai-bot-text: var(--text-main);
    --ai-bot-accent: var(--accent);
    --ai-bot-accent-rgb: 139, 92, 246;
    --ai-bot-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --ai-message-user: rgba(139, 92, 246, 0.15);
    --ai-message-bot: rgba(255, 255, 255, 0.03);
    --ai-input-bg: rgba(255, 255, 255, 0.03);
    --ai-input-area-bg: rgba(0, 0, 0, 0.2);
}

html[data-theme="light"] {
    --ai-bot-bg: #ffffff;
    --ai-bot-border: #e4e4e7;
    --ai-bot-text: #09090b;
    --ai-bot-accent: #7c3aed;
    --ai-bot-accent-rgb: 124, 58, 237;
    --ai-bot-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --ai-message-user: #f5f3ff;
    --ai-message-bot: #ffffff;
    --ai-input-bg: #f9fafb;
    --ai-input-area-bg: #ffffff;
}

.ai-chat-window {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 350px;
    background: var(--ai-bot-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--ai-bot-border);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    box-shadow: var(--ai-bot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: inherit;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-chat-window.static {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 1px solid var(--ai-bot-border);
    background: var(--ai-bot-bg);
}

.ai-chat-header {
    padding: 20px 25px;
    background: linear-gradient(to right, rgba(var(--ai-bot-accent-rgb), 0.1), transparent);
    border-bottom: 1px solid var(--ai-bot-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--ai-bot-text);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.8;
}

.ai-chat-status {
    width: 6px;
    height: 6px;
    background: #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 10px #00ff88;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

.ai-chat-messages::-webkit-scrollbar {
    display: none;
}

.ai-message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: messageIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-message.bot {
    align-self: flex-start;
    background: var(--ai-message-bot);
    color: var(--ai-bot-text);
    border: 1px solid var(--ai-bot-border);
    border-bottom-left-radius: 4px;
}

.ai-message.user {
    align-self: flex-end;
    background: var(--ai-message-user);
    color: var(--ai-bot-text);
    border: 1px solid rgba(var(--ai-bot-accent-rgb), 0.3);
    border-bottom-right-radius: 4px;
}

.ai-message.log {
    align-self: center;
    background: transparent;
    color: var(--accent);
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    padding: 4px 10px;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    max-width: 100%;
}

.ai-chat-input-area {
    padding: 20px 25px;
    border-top: 1px solid var(--ai-bot-border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--ai-input-area-bg);
}

.ai-chat-actions {
    display: flex;
    gap: 8px;
}

.ai-chat-action-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--ai-bot-text);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.ai-chat-action-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--ai-bot-accent);
}

.ai-chat-action-btn svg {
    width: 18px;
    height: 18px;
}

.ai-chat-input {
    flex: 1;
    background: var(--ai-input-bg);
    border: 1px solid var(--ai-bot-border);
    border-radius: 14px;
    padding: 12px 18px;
    color: var(--ai-bot-text);
    outline: none;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.ai-chat-input:focus {
    border-color: rgba(var(--ai-bot-accent-rgb), 0.5);
    background: rgba(255, 255, 255, 0.05);
}

.ai-chat-send {
    background: var(--ai-bot-accent);
    color: white;
    border: none;
    border-radius: 14px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-send:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
    box-shadow: 0 0 20px rgba(var(--ai-bot-accent-rgb), 0.4);
}

.ai-chat-send:active {
    transform: scale(0.95);
}

.ai-chat-send svg {
    width: 20px;
    height: 20px;
}

.ai-typing {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    background: var(--ai-message-bot);
    border-radius: 18px;
    width: fit-content;
    align-self: flex-start;
    border: 1px solid var(--ai-bot-border);
    animation: messageIn 0.3s ease-out;
}

.ai-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--ai-bot-text);
    opacity: 0.5;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.ai-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-4px);
        opacity: 0.8;
    }
}

@media (max-width: 768px) {
    .ai-chat-window {
        width: 100%;
        height: 500px;
    }
}

/* Persona Selector Styles */
.ai-chat-title-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.ai-persona-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid var(--ai-bot-border);
}

.ai-persona-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    margin-right: 4px;
}

.ai-persona-btn {
    background: transparent;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--ai-bot-text);
    opacity: 0.4;
    text-transform: uppercase;
}

.ai-persona-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    filter: grayscale(0.5) opacity(0.8);
}

.ai-persona-btn.active {
    background: rgba(var(--ai-bot-accent-rgb), 0.2);
    filter: grayscale(0) opacity(1);
    box-shadow: 0 0 10px rgba(var(--ai-bot-accent-rgb), 0.2);
}