/* Studio Chatbot Styles - Isolated to prevent conflicts */

#studio-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    outline: none;
}

.chatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.chatbot-toggle:active {
    transform: translateY(0);
}

/* Chatbot SVG Icon */
.chatbot-icon {
    width: 50px;
    /* height: 36px; */
    transition: all 0.3s ease;
}

.chatbot-toggle:hover .chatbot-icon {
    transform: scale(1.1);
}

/* Animate the chat bubble on hover */
.chatbot-toggle:hover .chatbot-icon text {
    animation: chatbot-bounce 0.6s ease-in-out;
}

@keyframes chatbot-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* Chatbot Header Icon */
.chatbot-title i {
    margin-right: 8px;
    font-size: 18px;
}

/* Message Avatar Icon */
.message-avatar-icon {
    width: 35px;
    /* height: 20px; */
}

/* Custom Scrollbar for Chatbot Messages */
.chatbot-messages {
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* Light theme scrollbar */
body.light-theme .chatbot-messages {
    scrollbar-color: rgba(102, 126, 234, 0.4) transparent;
}

body.light-theme .chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.4);
}

body.light-theme .chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.6);
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: chatbot-pulse 2s infinite;
}

@keyframes chatbot-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Chatbot Interface */
.chatbot-interface {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatbot-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-interface.show {
    display: flex;
}

@keyframes chatbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
}

.chatbot-title i {
    font-size: 18px;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    outline: none;
}

.chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Message Styles */
.chatbot-message {
    display: flex;
    gap: 12px;
    max-width: 100%;
    animation: chatbot-message-fade-in 0.3s ease-out;
}

@keyframes chatbot-message-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user-message {
    flex-direction: row-reverse;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    flex: 1;
    min-width: 0;
}

.message-content p {
    margin: 0 0 8px 0;
    line-height: 1.5;
    font-size: 14px;
    color: inherit;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 8px 0 0 0;
    padding-left: 16px;
    font-size: 14px;
    line-height: 1.4;
}

.message-content li {
    margin-bottom: 4px;
    color: inherit;
}

/* Input Area */
.chatbot-input-area {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.chatbot-input-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#chatbot-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.4;
    max-height: 80px;
    min-height: 20px;
}

#chatbot-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chatbot-send-btn {
    width: 50px;
    height: 47px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
    flex-shrink: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chatbot-send-btn:disabled {
    background: #e2e8f0;
    color: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Typing Indicator in Chat Messages */
.typing-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px !important;
}

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

.typing-content .typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    animation: chatbot-typing-dot 1.4s infinite ease-in-out;
}

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

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

.typing-text {
    font-size: 13px;
    color: #667eea;
    font-style: italic;
}

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

/* Remove old typing indicator from input area */
.chatbot-typing-indicator {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 480px) {
    #studio-chatbot-container {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-interface {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        bottom: 75px;
        right: -15px;
    }
    
    .chatbot-toggle {
        width: 55px;
        height: 55px;
        font-size: 18px;
    }
}

/* Default Theme (Dark) - Studio's default is dark */
.chatbot-interface {
    background: #1a202c;
    border-color: #2d3748;
}

.chatbot-messages {
    background: #2d3748;
}

.message-content {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #4a5568;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.chatbot-input-area {
    background: #1a202c;
    border-color: #2d3748;
}

#chatbot-input {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

#chatbot-input:focus {
    background: #4a5568;
    border-color: #667eea;
}

#chatbot-input::placeholder {
    color: #718096;
}

.user-message .message-avatar {
    background: #4a5568;
    color: #e2e8f0;
}

.typing-text {
    color: #a0aec0;
}

.typing-content .typing-dots span {
    background: #a0aec0;
}

/* Light Theme - Override dark theme when light-theme class is present */
body.light-theme .chatbot-interface {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .chatbot-messages {
    background: #f8fafc;
}

body.light-theme .message-content {
    background: white;
    color: #2d3748;
    border-color: #e2e8f0;
}

body.light-theme .user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

body.light-theme .chatbot-input-area {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme #chatbot-input {
    background: #f8fafc;
    color: #2d3748;
    border-color: #e2e8f0;
}

body.light-theme #chatbot-input:focus {
    background: white;
    border-color: #667eea;
}

body.light-theme #chatbot-input::placeholder {
    color: #a0aec0;
}

body.light-theme .bot-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body.light-theme .user-message .message-avatar {
    background: #e2e8f0;
    color: #4a5568;
}

body.light-theme .typing-text {
    color: #667eea;
}

body.light-theme .typing-content .typing-dots span {
    background: #667eea;
}

/* Animation for message streaming */
.message-content.streaming {
    position: relative;
}

.message-content.streaming::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 1em;
    background: currentColor;
    margin-left: 2px;
    animation: chatbot-cursor-blink 1s infinite;
}

@keyframes chatbot-cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
