/* public/css/voice-assistant.css */

/* Overlay principal */
.voice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.voice-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Container principal */
.voice-container {
    width: 90%;
    max-width: 500px;
    height: 80%;
    max-height: 700px;
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* Header */
.voice-header {
    padding: 20px 25px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.voice-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.voice-title i {
    color: #3BA7FF;
    font-size: 24px;
}

.voice-title h3 {
    color: white;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(90deg, #3BA7FF, #8A2BE2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.voice-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.voice-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Contenu principal */
.voice-content {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Status indicator */
.voice-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}

.status-indicator.idle {
    background: #4CAF50;
    animation: pulse 2s infinite;
}

.status-indicator.listening {
    background: #FF9800;
    animation: pulse 0.5s infinite;
}

.status-indicator.speaking {
    background: #2196F3;
    animation: pulse 1s infinite;
}

.status-indicator.processing {
    background: #9C27B0;
    animation: pulse 0.8s infinite;
}

.status-indicator.error {
    background: #F44336;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.status-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
}

/* Zone de réponse */
.voice-response {
    flex: 1;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 20px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

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

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

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

.assistant-message .message-avatar {
    background: linear-gradient(135deg, #3BA7FF 0%, #8A2BE2 100%);
}

.message-avatar i {
    color: white;
    font-size: 16px;
}

.message-content {
    flex: 1;
    max-width: calc(100% - 48px);
}

.message-content p {
    margin: 0;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.user-message .message-content p {
    background: rgba(59, 167, 255, 0.15);
    color: white;
    border-bottom-left-radius: 5px;
}

.assistant-message .message-content p {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
    border-bottom-right-radius: 5px;
}

.interim-transcript .message-content p {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Zone d'entrée */
.voice-input {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mic-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3BA7FF 0%, #8A2BE2 100%);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    font-size: 22px;
}

.mic-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(59, 167, 255, 0.3);
}

.mic-btn.listening {
    background: linear-gradient(135deg, #FF9800 0%, #F44336 100%);
    animation: pulseMic 0.5s infinite;
}

@keyframes pulseMic {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(255, 152, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0);
    }
}

.pulse-ring {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid #3BA7FF;
    border-radius: 50%;
    animation: ringPulse 2s infinite;
    opacity: 0;
}

@keyframes ringPulse {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Vague sonore */
.voice-wave {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
}

.wave-bar {
    width: 4px;
    height: 20px;
    background: rgba(59, 167, 255, 0.5);
    border-radius: 2px;
    animation: waveRest 1s ease-in-out infinite;
}

.voice-wave.active .wave-bar {
    animation: wave 1s ease-in-out infinite;
}

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

@keyframes wave {
    0%, 100% {
        height: 20px;
        background: rgba(59, 167, 255, 0.5);
    }
    50% {
        height: 40px;
        background: #3BA7FF;
    }
}

@keyframes waveRest {
    0%, 100% {
        height: 20px;
    }
    50% {
        height: 25px;
    }
}

/* Suggestions */
.voice-suggestions {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.suggestions-title {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 12px 0;
    font-weight: 600;
}

#voiceSuggestionsList {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#voiceSuggestionsList li {
    color: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid transparent;
}

#voiceSuggestionsList li:hover {
    background: rgba(59, 167, 255, 0.15);
    border-color: rgba(59, 167, 255, 0.3);
    transform: translateX(5px);
}

#voiceSuggestionsList li:before {
    content: '"';
    color: #3BA7FF;
    margin-right: 4px;
}

#voiceSuggestionsList li:after {
    content: '"';
    color: #3BA7FF;
    margin-left: 4px;
}

/* Footer */
.voice-footer {
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-info {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.help-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.3s;
}

.help-btn:hover {
    color: #3BA7FF;
}

/* Notifications */
.voice-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    border-left: 4px solid #3BA7FF;
    max-width: 300px;
    backdrop-filter: blur(10px);
}

.voice-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.voice-notification.error {
    border-left-color: #F44336;
}

.voice-notification i {
    font-size: 18px;
}

.voice-notification.error i {
    color: #F44336;
}

.voice-notification.info i {
    color: #3BA7FF;
}

/* Bouton toggle global */
.voice-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3BA7FF 0%, #8A2BE2 100%);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9998;
    font-size: 22px;
    box-shadow: 0 10px 30px rgba(59, 167, 255, 0.3);
    transition: all 0.3s;
    animation: float 3s ease-in-out infinite;
}

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

.voice-toggle-btn:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 15px 40px rgba(59, 167, 255, 0.4);
}

/* Erreur compatibilité */
.voice-compatibility-error {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    z-index: 9999;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.error-content i {
    font-size: 48px;
    color: #FF9800;
    margin-bottom: 20px;
}

.error-content h4 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 20px;
}

.error-content p {
    color: rgba(255, 255, 255, 0.7);
    margin: 5px 0;
    line-height: 1.5;
}

/* Scrollbar personnalisée */
.voice-response::-webkit-scrollbar {
    width: 8px;
}

.voice-response::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.voice-response::-webkit-scrollbar-thumb {
    background: rgba(59, 167, 255, 0.3);
    border-radius: 4px;
}

.voice-response::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 167, 255, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .voice-container {
        width: 95%;
        height: 90%;
        max-height: none;
        border-radius: 15px;
    }
    
    .voice-header {
        padding: 15px 20px;
    }
    
    .voice-content {
        padding: 20px;
    }
    
    .voice-input {
        padding: 15px;
    }
    
    .mic-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    
    .voice-toggle-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
    }
    
    .message-avatar i {
        font-size: 14px;
    }
    
    .message-content p {
        font-size: 13px;
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .voice-title h3 {
        font-size: 16px;
    }
    
    .voice-status {
        padding: 10px 15px;
    }
    
    .voice-suggestions {
        padding: 15px;
    }
    
    #voiceSuggestionsList li {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .voice-footer {
        padding: 12px 20px;
    }
}

/* Animation d'entrée */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* État body quand assistant actif */
body.voice-assistant-active {
    overflow: hidden;
}