/* AI Chatbot - Frontend Styles */
:root {
    --chatbot-primary-blue: #007AFF;
    --chatbot-primary-green: #34C759;
    --chatbot-primary-purple: #AF52DE;
    --chatbot-primary-dark: #1D1D1F;
    --chatbot-bg-light: #F2F2F7;
    --chatbot-bg-dark: #000000;
    --chatbot-text-light: #FFFFFF;
    --chatbot-text-dark: #000000;
    --chatbot-border: #E5E5EA;
    --chatbot-shadow: rgba(0, 0, 0, 0.1);
    --chatbot-radius: 18px;
}

/* Floating Chatbot Button */
#ai-chatbot-floating {
    position: fixed;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--chatbot-primary-blue), #5AC8FA);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.3);
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

#ai-chatbot-floating.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

#ai-chatbot-floating.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

#ai-chatbot-floating.position-top-right {
    top: 20px;
    right: 20px;
}

#ai-chatbot-floating.position-top-left {
    top: 20px;
    left: 20px;
}

#ai-chatbot-floating:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 122, 255, 0.4);
}

#ai-chatbot-floating::before {
    content: '💬';
    font-size: 24px;
    filter: brightness(0) invert(1);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Chat Window */
.ai-chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: var(--chatbot-bg-light);
    border-radius: var(--chatbot-radius);
    box-shadow: 0 20px 60px var(--chatbot-shadow);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    backdrop-filter: blur(20px);
    border: 1px solid var(--chatbot-border);
}

.ai-chatbot-window.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.ai-chatbot-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 16px 20px;
    border-bottom: 1px solid var(--chatbot-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chatbot-header .chatbot-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chatbot-header .chatbot-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--chatbot-primary-blue), #5AC8FA);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.ai-chatbot-header .chatbot-avatar::before {
    content: '🤖';
}

.ai-chatbot-header .chatbot-details h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--chatbot-text-dark);
}

.ai-chatbot-header .chatbot-details p {
    margin: 0;
    font-size: 12px;
    color: #8E8E93;
}

.ai-chatbot-header .close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #8E8E93;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.ai-chatbot-header .close-btn:hover {
    background: #F2F2F7;
    color: var(--chatbot-text-dark);
}

/* Chat Messages */
.ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--chatbot-bg-light);
}

.ai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chatbot-messages::-webkit-scrollbar-thumb {
    background: #C7C7CC;
    border-radius: 3px;
}

.ai-chatbot-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--chatbot-radius);
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chatbot-message.user {
    background: var(--chatbot-primary-blue);
    color: var(--chatbot-text-light);
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

.ai-chatbot-message.bot {
    background: #FFFFFF;
    color: var(--chatbot-text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-chatbot-message .timestamp {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.ai-chatbot-message.bot .timestamp {
    text-align: left;
}

/* Typing Indicator */
.ai-chatbot-typing {
    align-self: flex-start;
    background: #FFFFFF;
    border-radius: var(--chatbot-radius);
    border-bottom-left-radius: 6px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: none;
}

.ai-chatbot-typing.active {
    display: block;
    animation: messageSlide 0.3s ease;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #C7C7CC;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

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

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat Input */
.ai-chatbot-input {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 16px 20px;
    border-top: 1px solid var(--chatbot-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chatbot-input input {
    flex: 1;
    border: none;
    outline: none;
    background: #F2F2F7;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.ai-chatbot-input input:focus {
    background: #FFFFFF;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.ai-chatbot-input button {
    background: var(--chatbot-primary-blue);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    color: white;
}

.ai-chatbot-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.ai-chatbot-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-chatbot-input button::before {
    content: '➤';
    transform: rotate(-90deg);
}

/* Theme Variations */
.ai-chatbot-window.theme-green {
    --chatbot-primary-blue: var(--chatbot-primary-green);
}

.ai-chatbot-window.theme-purple {
    --chatbot-primary-blue: var(--chatbot-primary-purple);
}

.ai-chatbot-window.theme-dark {
    --chatbot-bg-light: var(--chatbot-bg-dark);
    --chatbot-text-dark: var(--chatbot-text-light);
    --chatbot-border: #38383A;
}

/* Theme variations for floating button */
#ai-chatbot-floating.theme-green {
    background: linear-gradient(135deg, var(--chatbot-primary-green), #66D37E);
    box-shadow: 0 8px 32px rgba(52, 199, 89, 0.3);
}

#ai-chatbot-floating.theme-green:hover {
    box-shadow: 0 12px 40px rgba(52, 199, 89, 0.4);
}

#ai-chatbot-floating.theme-purple {
    background: linear-gradient(135deg, var(--chatbot-primary-purple), #C77DE8);
    box-shadow: 0 8px 32px rgba(175, 82, 222, 0.3);
}

#ai-chatbot-floating.theme-purple:hover {
    box-shadow: 0 12px 40px rgba(175, 82, 222, 0.4);
}

#ai-chatbot-floating.theme-dark {
    background: linear-gradient(135deg, #1D1D1F, #38383A);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#ai-chatbot-floating.theme-dark:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.ai-chatbot-window.theme-dark .ai-chatbot-header {
    background: rgba(0, 0, 0, 0.95);
}

.ai-chatbot-window.theme-dark .ai-chatbot-input {
    background: rgba(0, 0, 0, 0.95);
}

.ai-chatbot-window.theme-dark .ai-chatbot-message.bot {
    background: #1C1C1E;
    color: var(--chatbot-text-light);
}

.ai-chatbot-window.theme-dark .ai-chatbot-input input {
    background: #1C1C1E;
    color: var(--chatbot-text-light);
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100vh;
    }
    
    #ai-chatbot-floating {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }
}

/* Shortcode Container */
#ai-chatbot-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border-radius: var(--chatbot-radius);
    overflow: hidden;
    box-shadow: 0 10px 40px var(--chatbot-shadow);
    background: var(--chatbot-bg-light);
    display: flex;
    flex-direction: column;
}

#ai-chatbot-container .ai-chatbot-messages {
    height: 400px;
}