/* CMS Chatbot Widget Styles */

/* Chat toggle button */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: chatPulse 2s ease-in-out infinite;
}

/* Gentle pulse animation to draw attention */
@keyframes chatPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(30, 64, 175, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(59, 130, 246, 0.6), 0 0 0 8px rgba(59, 130, 246, 0.1);
    }
}

/* Stop pulsing once opened */
.chatbot-toggle.active {
    animation: none;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(30, 64, 175, 0.5);
    animation: none;
}

/* Attention bubble - appears briefly on load */
.chatbot-attention {
    position: fixed;
    bottom: 92px;
    right: 24px;
    background: white;
    color: #1e293b;
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    max-width: 220px;
    animation: attentionSlide 0.3s ease, attentionFade 0.5s ease 8s forwards;
    pointer-events: none;
}

.chatbot-attention strong {
    display: block;
    margin-bottom: 4px;
    color: #1e40af;
}

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

@keyframes attentionFade {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Dark mode for attention bubble */
.dark .chatbot-attention {
    background: #374151;
    color: #f3f4f6;
}

.dark .chatbot-attention strong {
    color: #60a5fa;
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chatbot-toggle .chat-icon {
    display: block;
}

.chatbot-toggle .close-icon {
    display: none;
}

.chatbot-toggle.active .chat-icon {
    display: none;
}

.chatbot-toggle.active .close-icon {
    display: block;
}

/* Chat window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

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

/* Chat header */
.chatbot-header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header-avatar svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.chatbot-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-header-info p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.9;
}

/* Chat messages area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

/* Individual message */
.chatbot-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message.user {
    background: #1e40af;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chatbot-message.assistant {
    background: white;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Welcome message styling */
.chatbot-message.assistant.welcome {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
}

/* Typing indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* Chat input area */
.chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-input:focus {
    border-color: #3b82f6;
}

.chatbot-input::placeholder {
    color: #94a3b8;
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border: none;
    background: #1e40af;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chatbot-send:hover {
    background: #1e3a8a;
}

.chatbot-send:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.chatbot-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Scrollbar styling */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* Mobile adjustments */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chatbot-toggle {
        bottom: 16px;
        right: 16px;
    }
}

/* Dark mode support */
.dark .chatbot-window {
    background: #1f2937;
}

.dark .chatbot-messages {
    background: #111827;
}

.dark .chatbot-message.assistant {
    background: #374151;
    color: #f3f4f6;
}

.dark .chatbot-message.assistant.welcome {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
    border-color: #1e40af;
}

.dark .chatbot-typing {
    background: #374151;
}

.dark .chatbot-typing span {
    background: #6b7280;
}

.dark .chatbot-input-area {
    background: #1f2937;
    border-top-color: #374151;
}

.dark .chatbot-input {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.dark .chatbot-input::placeholder {
    color: #9ca3af;
}
