/* AI Agents Chat Widget Styles */

.aia-chat-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    max-width: 600px;
    margin: 20px auto;
}

.aia-chat-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px;
}

/* ==================== HEADER ==================== */

.aia-chat-header {
    background: linear-gradient(135deg, var(--aia-gradient-start, #4F46E5) 0%, var(--aia-gradient-end, #7C3AED) 100%);
    padding: 20px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aia-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aia-status-dot {
    width: 10px;
    height: 10px;
    background: #10B981;
    border-radius: 50%;
    animation: blink 2s infinite;
}

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

.aia-widget-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.aia-header-controls {
    display: flex;
    gap: 10px;
}

.aia-minimize-btn,
.aia-close-btn {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    font-family: Arial, sans-serif;
}

.aia-minimize-btn:hover,
.aia-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== MESSAGES AREA ==================== */

.aia-messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #F9FAFB;
    position: relative;
}

.aia-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aia-message {
    display: flex;
    flex-direction: column;
    animation: messageSlideIn 0.3s ease-out;
}

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

.aia-user-message {
    align-items: flex-end;
}

.aia-assistant-message {
    align-items: flex-start;
}

.aia-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 14px;
}

.aia-user-message .aia-message-content {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.aia-assistant-message .aia-message-content {
    background: #F3F4F6;
    color: #1F2937;
    border-bottom-left-radius: 4px;
}

.aia-message-content a {
    color: #3B82F6;
    text-decoration: underline;
}

.aia-user-message .aia-message-content a {
    color: #fff;
    opacity: 0.9;
}

/* Typing Indicator */
.aia-typing-indicator {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: #F3F4F6;
    border-radius: 18px;
    width: fit-content;
}

.aia-typing-dot {
    width: 8px;
    height: 8px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

/* Voice Wave Animation */
.aia-voice-waves {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.aia-wave-bar {
    width: 6px;
    background: linear-gradient(180deg, #4F46E5 0%, #7C3AED 100%);
    border-radius: 3px;
    animation: wave 1.2s infinite ease-in-out;
}

.aia-wave-bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.aia-wave-bar:nth-child(2) { height: 30px; animation-delay: 0.1s; }
.aia-wave-bar:nth-child(3) { height: 40px; animation-delay: 0.2s; }
.aia-wave-bar:nth-child(4) { height: 30px; animation-delay: 0.3s; }
.aia-wave-bar:nth-child(5) { height: 20px; animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.5); }
}

/* ==================== INPUT AREA ==================== */

.aia-input-container {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 12px;
    align-items: center;
}

.aia-mic-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    color: #fff;
    padding: 0;
}

.aia-mic-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.aia-mic-btn.listening {
    background: #EF4444;
    animation: pulse-mic 1.5s infinite;
}

@keyframes pulse-mic {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.aia-message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #D1D5DB;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.aia-message-input:focus {
    border-color: #4F46E5;
}

.aia-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    color: #fff;
    padding: 0;
}

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

.aia-send-btn svg {
    display: block;
}

/* ==================== FLOATING BUTTON ==================== */

.aia-floating-button {
    position: fixed;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--aia-primary-color, #4F46E5);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: float-pulse 2s infinite;
    bottom: 20px;
}

.aia-floating-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.aia-floating-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.6);
}

@keyframes float-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4); }
    50% { box-shadow: 0 8px 32px rgba(79, 70, 229, 0.6); }
}

/* ==================== FLOATING MODAL ==================== */

.aia-floating-modal {
    position: fixed;
    z-index: 10000;
    bottom: 90px;
    animation: slideUp 0.3s ease;
}

.aia-floating-modal .aia-modal-window {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.aia-floating-modal .aia-modal-card {
    height: var(--aia-chat-height, 600px);
    max-height: 80vh;
    width: var(--aia-chat-width, 400px);
}

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

/* ==================== MODAL OVERLAY ==================== */

.aia-chat-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.aia-chat-modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.aia-chat-modal {
    width: 100%;
    max-width: var(--aia-chat-width, 400px);
    height: auto;
    max-height: 90vh;
    animation: slideUp 0.3s ease;
}

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

.aia-chat-modal .aia-chat-card {
    height: var(--aia-chat-height, 600px);
    max-height: 90vh;
}

/* ==================== MOBILE RESPONSIVE ==================== */

@media (max-width: 768px) {
    .aia-chat-modal {
        max-width: 100%;
        max-height: 100vh;
        padding: 0;
    }
    
    .aia-chat-modal .aia-chat-card {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .aia-floating-button {
        width: 56px;
        height: 56px;
    }
    
    .aia-floating-button svg {
        width: 24px;
        height: 24px;
    }
    
    .aia-floating-modal {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100%;
    }
    
    .aia-floating-modal .aia-modal-card {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .aia-message-content {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .aia-chat-header {
        padding: 16px;
    }
    
    .aia-widget-title {
        font-size: 15px;
    }
    
    .aia-messages-container {
        padding: 16px;
    }
    
    .aia-input-container {
        padding: 12px 16px;
    }
    
    .aia-mic-btn,
    .aia-send-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    
    .aia-mic-btn svg,
    .aia-send-btn svg {
        width: 18px;
        height: 18px;
    }
}
