/* AI Chatbot floating widget CSS */

.ai-chatbot-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Chat bubble toggle button */
.ai-chatbot-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4), 0 0 0 6px rgba(102, 126, 234, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.ai-chatbot-bubble:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.6), 0 0 0 8px rgba(102, 126, 234, 0.25);
}

.ai-chatbot-bubble:active {
    transform: scale(0.95);
}

.ai-chatbot-bubble .ai-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff3366;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

/* Chat window container */
.ai-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom right;
}

.ai-chatbot-widget.active .ai-chatbot-window {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

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

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

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

.ai-chatbot-title {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
}

.ai-chatbot-subtitle {
    font-size: 11px;
    opacity: 0.8;
}

.ai-chatbot-close {
    cursor: pointer;
    font-size: 20px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-chatbot-close:hover {
    opacity: 1;
}

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

.ai-chatbot-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.ai-chatbot-msg.user {
    align-self: flex-end;
    background: #667eea;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.ai-chatbot-msg.ai {
    align-self: flex-start;
    background: rgba(0, 0, 0, 0.05);
    color: #333;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

/* Markdown parsing output styling */
.ai-chatbot-msg p {
    margin: 0 0 8px 0;
}
.ai-chatbot-msg p:last-child {
    margin-bottom: 0;
}
.ai-chatbot-msg strong {
    font-weight: bold;
}
.ai-chatbot-msg ul {
    margin: 5px 0;
    padding-left: 20px;
}
.ai-chatbot-msg li {
    margin-bottom: 3px;
}
.ai-chatbot-msg a {
    color: #667eea;
    font-weight: bold;
    text-decoration: underline;
}
.ai-chatbot-msg.user a {
    color: #fff;
}

/* Suggested questions list */
.ai-chatbot-suggestions {
    display: flex;
    gap: 8px;
    padding: 8px 20px;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    scrollbar-width: none; /* Firefox */
}

.ai-chatbot-suggestions::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.ai-chatbot-suggest-btn {
    background: #fff;
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #667eea;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 550;
}

.ai-chatbot-suggest-btn:hover {
    background: #667eea;
    color: #fff;
}

/* Input Area */
.ai-chatbot-input-area {
    padding: 12px 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
}

.ai-chatbot-input {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.1);
    outline: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
    transition: border-color 0.2s;
    color: #333 !important;
    background-color: #fff !important;
}

.ai-chatbot-input:focus {
    border-color: #667eea;
}

.ai-chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
    outline: none;
}

.ai-chatbot-send:hover {
    background: #764ba2;
}

/* Typing indicator */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 15px;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    background: #777;
    border-radius: 50%;
    animation: aiBounce 1.3s infinite;
}

.ai-typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.ai-typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

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

@media (max-width: 480px) {
    .ai-chatbot-widget {
        right: 15px;
        bottom: 15px;
    }
    
    .ai-chatbot-bubble {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
    
    .ai-chatbot-widget.active {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
    }

    .ai-chatbot-widget.active .ai-chatbot-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
        bottom: 0;
        right: 0;
        box-shadow: none;
        transform: none !important;
        opacity: 1;
        pointer-events: auto;
    }

    .ai-chatbot-header {
        padding: 16px 20px;
        border-radius: 0;
    }

    .ai-chatbot-messages {
        padding: 15px;
    }

    .ai-chatbot-msg {
        max-width: 85%;
        font-size: 14px;
        padding: 10px 14px;
    }

    .ai-chatbot-suggestions {
        padding: 10px 15px;
        background: #fdfdfd;
    }

    .ai-chatbot-input-area {
        padding: 12px 15px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); /* Safe area support for iOS home indicator */
    }
}
