/**
 * FAQ AI Chatbot Styles
 * Modern floating chat widget with glassmorphism
 */

/* CSS Variables for theming */
:root {
    --chat-primary: #667eea;
    --chat-primary-dark: #5a6fd6;
    --chat-secondary: #764ba2;
    --chat-accent: #e8a819;
    --chat-bg: #ffffff;
    --chat-bubble-user: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --chat-bubble-bot: #f1f5f9;
    --chat-text: #1e293b;
    --chat-text-light: #64748b;
    --chat-border: #e2e8f0;
    --chat-shadow: rgba(0, 0, 0, 0.1);
}

/* Floating Chat Button */
.faq-chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--chat-bubble-user);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.5);
}

.faq-chat-btn i {
    font-size: 28px;
    color: white;
    transition: transform 0.3s ease;
}

.faq-chat-btn.active i {
    transform: rotate(90deg);
}

.faq-chat-btn .chat-btn-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--chat-bubble-user);
    animation: chatPulse 2s infinite;
    z-index: -1;
}

@keyframes chatPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Chat Button Popup Message */
.faq-chat-popup {
    position: fixed;
    bottom: 40px;
    right: 100px;
    background: white;
    padding: 14px 18px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--chat-border);
    max-width: 280px;
    z-index: 9997;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-chat-popup.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.faq-chat-popup::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left-color: white;
    border-right: none;
}

.faq-chat-popup-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--chat-text);
    font-weight: 500;
}

.faq-chat-popup-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--chat-text-light);
    border: 2px solid white;
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.faq-chat-popup-close:hover {
    background: var(--chat-primary);
    transform: scale(1.1);
}

/* Chat Window */
.faq-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 600px;
    max-width: calc(100vw - 48px);
    height: 750px;
    max-height: calc(100vh - 130px);
    background: var(--chat-bg);
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15), 0 0 0 1px var(--chat-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.faq-chat-header {
    background: var(--chat-bubble-user);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.faq-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
}

.faq-chat-ai-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.faq-chat-ai-icon-small {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.faq-chat-header-info {
    flex: 1;
}

.faq-chat-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.faq-chat-header-status {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 6px;
}

.faq-chat-header-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.faq-chat-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.faq-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.faq-chat-reset {
    height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
    margin-right: 8px;
    font-size: 0.8rem;
    font-weight: 500;
}

.faq-chat-reset:hover {
    background: rgba(255, 255, 255, 0.3);
}

.faq-chat-reset i {
    font-size: 0.75rem;
}

/* Chat Messages Container */
.faq-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

/* Custom Scrollbar */
.faq-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.faq-chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 3px;
}

.faq-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chat-text-light);
}

/* Chat Message Bubbles */
.faq-chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

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

.faq-chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.faq-chat-message.bot {
    align-self: flex-start;
}

.faq-chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--chat-bubble-bot);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.faq-chat-message.user .faq-chat-message-avatar {
    background: var(--chat-primary);
    color: white;
}

.faq-chat-message.bot .faq-chat-message-avatar {
    background: white;
    padding: 4px;
}

.faq-chat-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.faq-chat-message.user .faq-chat-message-content {
    background: var(--chat-bubble-user);
    color: white;
    border-bottom-right-radius: 6px;
}

.faq-chat-message.bot .faq-chat-message-content {
    background: var(--chat-bubble-bot);
    color: var(--chat-text);
    border-bottom-left-radius: 6px;
}

/* Related Articles */
.faq-chat-related {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--chat-border);
}

.faq-chat-related-title {
    font-size: 0.75rem;
    color: var(--chat-text-light);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.faq-chat-related-link {
    display: block;
    font-size: 0.85rem;
    color: var(--chat-primary);
    text-decoration: none;
    padding: 6px 0;
    transition: color 0.2s;
}

.faq-chat-related-link:hover {
    color: var(--chat-secondary);
}

.faq-chat-related-link i {
    margin-right: 6px;
    font-size: 0.75rem;
}

/* Typing Indicator */
.faq-chat-typing {
    display: flex;
    gap: 10px;
    align-self: flex-start;
    max-width: 85%;
}

.faq-chat-typing .faq-chat-message-content {
    background: var(--chat-bubble-bot);
    padding: 16px 20px;
    display: flex;
    gap: 4px;
}

.faq-chat-typing .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-text-light);
    animation: typingDot 1.4s infinite ease-in-out;
}

.faq-chat-typing .dot:nth-child(1) { animation-delay: 0s; }
.faq-chat-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.faq-chat-typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Welcome Message */
.faq-chat-welcome {
    text-align: center;
    padding: 20px;
}

.faq-chat-welcome-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.faq-chat-welcome h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--chat-text);
    margin: 0 0 8px 0;
}

.faq-chat-welcome p {
    font-size: 0.9rem;
    color: var(--chat-text-light);
    margin: 0;
}

/* Quick Suggestions */
.faq-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.faq-chat-suggestion {
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--chat-text);
    cursor: pointer;
    transition: all 0.2s;
}

.faq-chat-suggestion:hover {
    background: var(--chat-primary);
    color: white;
    border-color: var(--chat-primary);
}

/* Chat Input */
.faq-chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid var(--chat-border);
    background: white;
    flex-shrink: 0;
}

.faq-chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #f8fafc;
    border-radius: 25px;
    padding: 6px 6px 6px 18px;
    border: 1px solid var(--chat-border);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.faq-chat-input-wrapper:focus-within {
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.faq-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--chat-text);
    outline: none;
    padding: 8px 0;
}

.faq-chat-input::placeholder {
    color: var(--chat-text-light);
}

.faq-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--chat-bubble-user);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.faq-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.faq-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.faq-chat-send i {
    font-size: 16px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .faq-chat-btn {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    
    .faq-chat-btn i {
        font-size: 24px;
    }
    
    .faq-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .faq-chat-window.active {
        border-radius: 0;
    }
    
    .faq-chat-header {
        border-radius: 0;
    }
    
    .faq-chat-messages {
        padding: 16px;
    }
    
    .faq-chat-message {
        max-width: 90%;
    }
}

/* Markdown content in messages */
.faq-chat-message-content p {
    margin: 0 0 8px 0;
}

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

.faq-chat-message-content ul,
.faq-chat-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.faq-chat-message-content li {
    margin: 4px 0;
}

.faq-chat-message-content strong {
    font-weight: 600;
}

.faq-chat-message-content a {
    color: inherit;
    text-decoration: underline;
}

.faq-chat-message.user .faq-chat-message-content a {
    color: white;
}

.faq-chat-message.bot .faq-chat-message-content a {
    color: var(--chat-primary);
}

