/**
 * Fabcrush Voice Assistant Styles
 * 
 * Modern, accessible voice assistant UI positioned above cookie settings
 * Following Samurai design principles for clean, professional appearance
 */

/* ====== VOICE ASSISTANT CONTAINER ====== */
.fabcrush-voice-assistant {
    position: fixed;
    bottom: 120px; /* Position above cookie settings button */
    left: 20px; /* Position on left side */
    z-index: 999998; /* Just below GDPR banner */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ====== VOICE ASSISTANT BUTTON ====== */
.voice-assistant-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Special styling when using PNG images to preserve transparency */
.voice-assistant-btn.with-png-icon {
    background: rgba(102, 126, 234, 0.1) !important;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.voice-assistant-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.voice-assistant-btn:active {
    transform: translateY(0);
}

/* ====== BUTTON STATES ====== */
.voice-assistant-btn.connecting {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    animation: pulse 1.5s infinite;
}

.voice-assistant-btn.connected {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.voice-assistant-btn.listening {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    animation: listening-pulse 1s infinite;
}

.voice-assistant-btn.processing {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    animation: processing-spin 2s linear infinite;
}

.voice-assistant-btn.speaking {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: speaking-bounce 0.6s infinite alternate;
}

.voice-assistant-btn.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    animation: error-shake 0.5s;
}

/* ====== BUTTON ANIMATIONS ====== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes listening-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.3);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 8px 30px rgba(255, 107, 107, 0.6);
    }
}

@keyframes processing-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes speaking-bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-4px); }
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ====== VOICE ICON ====== */
.voice-assistant-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
    background: transparent !important;
}

.voice-assistant-icon img {
    background: transparent !important;
    border: none;
    outline: none;
}

.voice-assistant-btn.listening .voice-assistant-icon {
    transform: scale(1.2);
}

/* ====== STATUS TEXT ====== */
.voice-assistant-status {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.voice-assistant-btn:not(.idle) .voice-assistant-status {
    opacity: 1;
}

/* ====== VOICE VISUALIZER ====== */
.voice-visualizer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: -1;
}

.voice-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.voice-bar {
    width: 3px;
    height: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    animation: voice-wave 1.2s infinite ease-in-out;
}

.voice-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-bar:nth-child(4) { animation-delay: 0.3s; }
.voice-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes voice-wave {
    0%, 40%, 100% {
        transform: scaleY(0.4);
        opacity: 0.5;
    }
    20% {
        transform: scaleY(1);
        opacity: 1;
    }
}

.voice-visualizer.active .voice-bar {
    animation-play-state: running;
}

.voice-visualizer:not(.active) .voice-bar {
    animation-play-state: paused;
    transform: scaleY(0.4);
    opacity: 0.5;
}

/* ====== RESPONSIVE DESIGN ====== */
@media (max-width: 768px) {
    .fabcrush-voice-assistant {
        bottom: 100px;
        left: 15px; /* Keep on left side for mobile */
    }
    
    .voice-assistant-btn {
        width: 50px;
        height: 50px;
    }
    
    .voice-assistant-icon {
        width: 20px;
        height: 20px;
    }
    
    .voice-assistant-status {
        font-size: 11px;
        bottom: -25px;
    }
}

@media (max-width: 480px) {
    .fabcrush-voice-assistant {
        bottom: 80px;
        left: 10px; /* Keep on left side for small mobile */
    }
    
    .voice-assistant-btn {
        width: 45px;
        height: 45px;
    }
    
    .voice-assistant-icon {
        width: 18px;
        height: 18px;
    }
}

/* ====== ACCESSIBILITY ====== */
.voice-assistant-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.voice-assistant-btn:focus:not(:focus-visible) {
    outline: none;
}

.voice-assistant-btn[aria-pressed="true"] {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

/* ====== HIGH CONTRAST MODE ====== */
@media (prefers-contrast: high) {
    .voice-assistant-btn {
        background: #000;
        border: 2px solid #fff;
    }
    
    .voice-assistant-btn.listening {
        background: #ff0000;
    }
    
    .voice-assistant-btn.connected {
        background: #00ff00;
    }
}

/* ====== REDUCED MOTION ====== */
@media (prefers-reduced-motion: reduce) {
    .voice-assistant-btn,
    .voice-assistant-icon,
    .voice-assistant-status,
    .voice-bar {
        animation: none !important;
        transition: none !important;
    }
    
    .voice-assistant-btn:hover {
        transform: none;
    }
}

/* ====== DARK MODE SUPPORT ====== */
@media (prefers-color-scheme: dark) {
    .voice-assistant-status {
        background: rgba(255, 255, 255, 0.9);
        color: #000;
    }
}

/* ====== PRINT STYLES ====== */
@media print {
    .fabcrush-voice-assistant {
        display: none;
    }
}
