/* Chat Assistant Styles */

/* Reset du padding de .view pour le chat */
#view-chat-assistant,
#view-chat-assistant-global {
    padding: 0 !important;
    /* Soustraire header (50px) + marge barre des tâches (60px) */
    height: calc(100vh - 110px) !important;
    overflow: hidden !important;
    margin-bottom: 20px;
}

.chat-assistant-container {
    display: flex;
    flex-direction: column;
    /* Prendre toute la hauteur disponible du parent */
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #2c7a31 0%, #236122 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.btn-back {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-back:hover {
    background: rgba(255,255,255,0.3);
    transform: translateX(-2px);
}

.chat-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: 1rem;
}

.chat-icon {
    font-size: 2rem;
}

.chat-title h2 {
    margin: 0;
    font-size: 1.3rem;
}

.chat-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

.chat-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-voice, .btn-clear {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-voice:hover, .btn-clear:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.btn-voice.active {
    background: #4caf50;
}

.chat-messages {
    flex: 1;
    min-height: 0; /* Important pour que flex fonctionne correctement */
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
}

.welcome-message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease-out;
}

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

.message-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease-out;
}

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

.avatar-assistant, .avatar-user {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

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

.avatar-user {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.message-bubble {
    max-width: 70%;
    padding: 1rem 1.25rem;
    border-radius: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    line-height: 1.5;
}

.message-bubble.assistant {
    background: white;
    border-bottom-left-radius: 0.25rem;
}

.message-bubble.user {
    background: linear-gradient(135deg, #2c7a31 0%, #236122 100%);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message-bubble p {
    margin: 0 0 0.5rem 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-bubble li {
    margin-bottom: 0.25rem;
}

.message-bubble strong {
    color: #2c7a31;
}

.message-bubble.user strong {
    color: #fff;
}

.hint {
    font-size: 0.9rem;
    opacity: 0.8;
    font-style: italic;
}

.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 1rem;
}

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

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

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

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

.chat-input-container {
    background: white;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-shrink: 0;
    min-height: 80px;
    /* S'assurer qu'il reste toujours visible */
    position: relative;
    z-index: 10;
}

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

.btn-voice-input:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-voice-input:active, .btn-voice-input.recording {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(245, 87, 108, 0);
    }
}

.input-wrapper {
    flex: 1;
    display: flex;
    gap: 0.5rem;
    background: #f5f5f5;
    border-radius: 25px;
    padding: 0.5rem 1rem;
    align-items: center;
}

#chatInput {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    outline: none;
    padding: 0.5rem 0;
}

.btn-send {
    background: linear-gradient(135deg, #2c7a31 0%, #236122 100%);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(44, 122, 49, 0.4);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.voice-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: 2rem;
    display: none;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.voice-indicator.active {
    display: flex;
}

.voice-wave {
    width: 4px;
    height: 20px;
    background: linear-gradient(to top, #667eea, #f5576c);
    border-radius: 2px;
    animation: wave 0.8s ease-in-out infinite;
}

.voice-wave:nth-child(2) {
    animation-delay: 0.2s;
}

.voice-wave:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes wave {
    0%, 100% {
        height: 10px;
    }
    50% {
        height: 30px;
    }
}

.voice-text {
    font-size: 1rem;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-header {
        padding: 0.75rem 1rem;
    }

    .chat-title h2 {
        font-size: 1.1rem;
    }

    .chat-subtitle {
        font-size: 0.75rem;
    }

    .chat-messages {
        padding: 1rem;
    }

    .message-bubble {
        max-width: 85%;
    }

    .btn-voice-input {
        width: 45px;
        height: 45px;
    }
}
