/**
 * AI Voice Support Styles
 * Glassmorphism modal with animated avatar floating button
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --ai-primary: #8b5cf6;
    --ai-primary-light: #a78bfa;
    --ai-secondary: #6366f1;
    --ai-bg-dark: rgba(13, 17, 23, 0.98);
    --ai-bg-card: rgba(22, 27, 34, 0.95);
    --ai-glass-blur: 20px;
    --ai-border-light: rgba(255, 255, 255, 0.1);
    --ai-success: #22c55e;
    --ai-error: #ef4444;
    --ai-warning: #f59e0b;
}

/* ============================================
   Floating AI Wrapper & Button
   ============================================ */
.ai-floating-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Speech Bubble Label */
.ai-floating-label {
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    animation: aiLabelFloat 3s ease-in-out infinite;
    position: relative;
    font-family: 'Poppins', sans-serif;
}

/* Triangle pointer */
.ai-floating-label::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--ai-secondary);
}

@keyframes aiLabelFloat {
    0%, 100% { 
        transform: translateY(0); 
        opacity: 1; 
    }
    50% { 
        transform: translateY(-5px); 
        opacity: 0.9; 
    }
}

/* Circular Avatar Button */
.ai-floating-btn {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    border: 4px solid var(--ai-primary-light);
    outline: none;
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    animation: aiGentleFloat 4s ease-in-out infinite;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@keyframes aiGentleFloat {
    0%, 100% { 
        transform: translateY(0) scale(1); 
    }
    50% { 
        transform: translateY(-8px) scale(1.02); 
    }
}

.ai-floating-btn:hover {
    transform: scale(1.15) !important;
    box-shadow: 0 15px 50px rgba(139, 92, 246, 0.6);
    animation-play-state: paused;
}

.ai-floating-btn:active {
    transform: scale(1.05) !important;
}

/* Avatar Image */
.ai-floating-btn .ai-btn-gif {
    width: 140%;
    height: 140%;
    object-fit: cover;
    object-position: center top;
    margin-top: 15px;
    pointer-events: none;
}

/* ============================================
   AI Voice Modal
   ============================================ */
.ai-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.ai-modal.active {
    display: flex;
}

.ai-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--ai-bg-dark);
    backdrop-filter: blur(var(--ai-glass-blur));
}

.ai-modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    background: var(--ai-bg-card);
    border-radius: 24px;
    border: 1px solid var(--ai-border-light);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    padding: 40px;
    text-align: center;
    animation: aiModalSlideIn 0.3s ease;
}

@keyframes aiModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close Button */
.ai-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ai-modal-close:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: rotate(90deg);
}

/* Modal Avatar */
.ai-modal-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 0 auto 24px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    border: 4px solid var(--ai-primary-light);
    box-shadow: 0 10px 40px rgba(139, 92, 246, 0.4);
}

.ai-modal-avatar img {
    width: 140%;
    height: 140%;
    object-fit: cover;
    object-position: center top;
    margin-top: 20px;
}

/* Status Indicator */
.ai-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #94a3b8;
}

.ai-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #64748b;
    animation: aiPulse 2s infinite;
}

@keyframes aiPulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1); 
    }
    50% { 
        opacity: 0.5; 
        transform: scale(0.9); 
    }
}

/* Status States */
.ai-status.connecting .ai-status-dot {
    background: var(--ai-warning);
}

.ai-status.connected .ai-status-dot {
    background: var(--ai-success);
    box-shadow: 0 0 10px var(--ai-success);
}

.ai-status.listening .ai-status-dot {
    background: var(--ai-primary);
    box-shadow: 0 0 10px var(--ai-primary);
    animation: aiPulse 1s infinite;
}

.ai-status.speaking .ai-status-dot {
    background: var(--ai-success);
    box-shadow: 0 0 15px var(--ai-success);
    animation: aiPulse 0.5s infinite;
}

.ai-status.error .ai-status-dot {
    background: var(--ai-error);
    box-shadow: 0 0 10px var(--ai-error);
    animation: none;
}

/* Audio Visualizer */
.ai-visualizer-container {
    height: 80px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-visualizer {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
}

/* Controls */
.ai-controls {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.ai-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-btn-end {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.ai-btn-end:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.ai-btn-retry {
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    display: none;
}

.ai-btn-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.ai-btn-retry.visible {
    display: flex;
}

/* Microphone Indicator */
.ai-mic-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 13px;
    color: #64748b;
}

.ai-mic-indicator i {
    color: var(--ai-primary);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .ai-floating-wrapper {
        bottom: 15px;
        right: 15px;
    }
    
    .ai-floating-btn {
        width: 80px;
        height: 80px;
    }
    
    .ai-floating-label {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .ai-modal-content {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .ai-modal-avatar {
        width: 120px;
        height: 120px;
    }
    
    .ai-controls {
        flex-direction: column;
    }
    
    .ai-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Quick Call Area Adjustment
   ============================================ */
.quick_call_area {
    right: 140px !important;
}

@media (max-width: 768px) {
    .quick_call_area {
        right: 110px !important;
    }
}
