/* Estilos del chatbot */
.chat-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Scrollbar personalizado */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mensajes */
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeInUp 0.3s ease-out;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bot-message {
    align-self: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    color: white;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    font-size: 14px;
}

.bot-message .message-text {
    background: #f8f9fa;
    color: #333;
    border-bottom-left-radius: 6px;
}

.user-message .message-text {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
    padding: 0 4px;
}

.user-message .message-time {
    text-align: right;
}

/* Área de entrada */
.chat-input-container {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
    position: relative;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: end;
}

.chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.send-button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.send-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Botón de voz */
.voice-button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    padding: 0;
    position: relative;
    overflow: hidden;
}


.voice-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.voice-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.voice-button.recording {
    background: linear-gradient(135deg, #dc3545, #c82333);
    animation: pulse 1s infinite;
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.4);
}

@keyframes pulse {
    0% { box-shadow: 0 0 20px rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 30px rgba(220, 53, 69, 0.6); }
    100% { box-shadow: 0 0 20px rgba(220, 53, 69, 0.4); }
}

.input-hint {
    font-size: 11px;
    color: #6c757d;
    margin-top: 8px;
    text-align: center;
}

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6c757d;
    animation: typing 1.4s infinite ease-in-out;
}

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

/* Indicador de transcripción */
.transcription-indicator {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    align-items: center;
    border-left: 3px solid #007bff;
    color: #333;
    font-weight: 500;
}

.transcription-indicator .typing-indicator {
    background: transparent;
    padding: 0;
    margin-left: 8px;
}

.transcription-indicator i.bi-mic-fill {
    color: #007bff;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Estados especiales */
.message-text ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-text ul li {
    margin: 4px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        height: 60vh;
        border-radius: 10px;
    }
    
    .message {
        max-width: 95%;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .chat-input-container {
        padding: 15px;
    }
    
    .message-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .message-text {
        font-size: 13px;
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        height: 55vh;
    }
    
    .message {
        max-width: 98%;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* Estilos para el modal */
.modal-content {
    background-color: #fff;
    color: #333;
}

.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    color: #333;
    font-weight: 600;
}

.modal-body {
    color: #333;
}

.modal-body h6 {
    color: #495057;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.modal-body h6:first-child {
    margin-top: 0;
}

.modal-body p {
    color: #6c757d;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.modal-body ul {
    color: #6c757d;
    margin-bottom: 1rem;
}

.modal-body ul li {
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.modal-body strong {
    color: #495057;
}

.modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Iconos en el modal */
.modal-body i.bi {
    margin-right: 0.5rem;
}

.text-primary {
    color: #007bff !important;
}

.text-success {
    color: #28a745 !important;
}

.text-info {
    color: #17a2b8 !important;
}

/* Contenedor de grabación */
.audio-recording-container {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 5px;
    animation: fadeInUp 0.3s ease-out;
    z-index: 1000;
}

.recording-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
}

.recording-timer {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 6px;
}

/* Responsive para botones de voz */
@media (max-width: 768px) {
    .voice-button,
    .send-button {
        width: 40px;
        height: 40px;
    }

    .chat-input-wrapper {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .voice-button,
    .send-button {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .recording-status {
        font-size: 12px;
    }

    .recording-timer {
        font-size: 14px;
        padding: 1px 6px;
    }
}

/* Overlay de grabación */
.recording-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.recording-overlay-content {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(220, 53, 69, 0.4);
    animation: pulse 1s infinite;
}

.recording-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: recordingPulse 1.5s infinite;
}

.recording-text {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.recording-timer-overlay {
    font-size: 20px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 10px;
    display: inline-block;
}

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

@keyframes recordingPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}