/* AI ASSISTANT POPUP - Advanced Floating Widget */

/* Floating Chat Button */
.ai-assistant-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    animation: pulse-button 2s infinite;
}

.ai-assistant-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.ai-assistant-button.hidden {
    transform: scale(0);
    opacity: 0;
}

@keyframes pulse-button {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 8px 32px rgba(102, 126, 234, 0.6), 0 0 0 8px rgba(102, 126, 234, 0.1);
    }
}

.ai-assistant-icon {
    font-size: 32px;
    animation: wave 2s infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(14deg); }
    20%, 40% { transform: rotate(-8deg); }
    50% { transform: rotate(0deg); }
}

/* Notification Badge */
.ai-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: #ff4757;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    animation: bounce 1s infinite;
}

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

/* Main Chat Window */
.ai-assistant-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-height: calc(100vh - 40px);
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.ai-assistant-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

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

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

.ai-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.ai-header-text h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.ai-header-text p {
    font-size: 12px;
    opacity: 0.9;
    margin: 2px 0 0 0;
    line-height: 1.2;
}

.ai-typing-indicator {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-8px); }
}

.ai-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Chat Messages Area */
.ai-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

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

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

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

/* Message Bubbles */
.ai-message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

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

.ai-message.user .ai-message-avatar {
    background: #e5e7eb;
}

.ai-message-content {
    max-width: 75%;
}

.ai-message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
}

.ai-message.bot .ai-message-bubble {
    background: white;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ai-message.user .ai-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 4px;
}

/* Quick Action Buttons */
.ai-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.ai-quick-btn {
    background: white;
    border: 2px solid #e5e7eb;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-quick-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateX(4px);
}

.ai-quick-btn:active {
    transform: translateX(4px) scale(0.98);
}

/* Calculator Form in Chat */
.ai-form-field {
    margin-bottom: 16px;
}

.ai-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
}

.ai-form-input,
.ai-form-select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    background: white;
}

.ai-form-input:focus,
.ai-form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ai-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
}

.ai-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.ai-submit-btn:active {
    transform: translateY(0);
}

/* Results Display */
.ai-results {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 16px;
    color: white;
    margin-top: 12px;
}

.ai-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-result-item:last-child {
    border-bottom: none;
}

.ai-result-label {
    font-size: 13px;
    opacity: 0.9;
}

.ai-result-value {
    font-size: 18px;
    font-weight: 700;
}

.ai-result-cta {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

.ai-cta-btn {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.ai-cta-primary {
    background: white;
    color: #667eea;
}

.ai-cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ai-cta-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.ai-cta-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Input Area */
.ai-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-message-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.ai-message-input:focus {
    outline: none;
    border-color: #667eea;
}

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

.ai-send-btn:hover {
    transform: scale(1.1);
}

.ai-send-btn:active {
    transform: scale(1);
}

/* Powered By Footer */
.ai-powered-by {
    padding: 12px 20px;
    background: #f8f9fa;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    border-top: 1px solid #e5e7eb;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ai-assistant-window {
        width: calc(100vw - 24px);
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        right: 12px;
        bottom: 12px;
        border-radius: 16px;
    }

    .ai-assistant-button {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .ai-assistant-icon {
        font-size: 28px;
    }

    .ai-form-row {
        grid-template-columns: 1fr;
    }

    .ai-chat-messages {
        padding: 12px;
    }

    .ai-assistant-header {
        padding: 12px 16px;
    }
}

/* Smooth Transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
