/**
 * ConversationalDemo.css
 * Estilos para el formulario conversacional inteligente
 * Versión: 1.0.0
 */

.conversational-demo {
    max-width: 450px;
    width: 100%;
    height: 600px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s ease;
}

.conversational-demo.minimized {
    height: 80px;
}

.conversational-demo.minimized .chat-messages,
.conversational-demo.minimized .chat-input-area,
.conversational-demo.minimized .powered-by {
    display: none;
}

/* Header del Chat */
.chat-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #19f342;
    box-shadow: 0 4px 12px rgba(25, 243, 66, 0.3);
}

.agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-details h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
}

.status {
    font-size: 13px;
    color: #68d391;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.btn-minimize {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-minimize:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #4a5568;
}

/* Contenedor de Mensajes */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Mensajes */
.message {
    display: flex;
    margin-bottom: 16px;
    animation: slideInMessage 0.3s ease-out;
}

.bot-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 20px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bot-message .message-content {
    background: linear-gradient(135deg, #ffffff 0%, #f7fafc 100%);
    color: #2d3748;
    border-bottom-left-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.user-message .message-content {
    background: linear-gradient(135deg, #19f342 0%, #38a169 100%);
    color: white;
    border-bottom-right-radius: 8px;
}

.message-text {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 6px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
}

.bot-message .message-time {
    color: #a0aec0;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Emojis */
.emoji {
    font-size: 18px;
    display: inline-block;
    margin: 0 2px;
}

/* Indicador de Escritura */
.typing-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.typing-content {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 16px;
    border-radius: 20px;
    border-bottom-left-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.typing-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #19f342;
}

.typing-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #19f342;
    border-radius: 50%;
    animation: typingDots 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Área de Input */
.chat-input-area {
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Input de Opciones */
.options-input {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: left;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.option-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.option-btn:active {
    transform: translateY(0);
}

/* Input de Texto */
.text-input .input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.text-input input {
    flex: 1;
    background: rgba(247, 250, 252, 0.8);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 15px;
    color: #2d3748;
    transition: all 0.2s ease;
}

.text-input input:focus {
    outline: none;
    border-color: #19f342;
    background: white;
    box-shadow: 0 0 0 3px rgba(25, 243, 66, 0.1);
}

.send-btn {
    background: linear-gradient(135deg, #19f342 0%, #38a169 100%);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(25, 243, 66, 0.3);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(25, 243, 66, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Input de Selección */
.select-input .select-options {
    display: grid;
    gap: 10px;
}

.select-option {
    background: rgba(247, 250, 252, 0.8);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-option:hover {
    background: white;
    border-color: #19f342;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25, 243, 66, 0.15);
}

.option-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-text {
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
}

/* Input de Calendario */
.calendar-input {
    max-height: 300px;
    overflow-y: auto;
}

.loading-calendar,
.booking-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 30px;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #19f342;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.available-slots {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.day-slots h4 {
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.time-slot {
    background: rgba(247, 250, 252, 0.8);
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #2d3748;
    text-align: center;
    transition: all 0.2s ease;
}

.time-slot:hover {
    background: #19f342;
    color: white;
    border-color: #19f342;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25, 243, 66, 0.3);
}

/* Estados de Error y Éxito */
.calendar-error,
.booking-error,
.no-slots {
    text-align: center;
    padding: 20px;
}

.booking-success {
    text-align: center;
    padding: 20px;
}

.success-actions,
.complete-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
}

.btn-primary,
.btn-secondary,
.contact-btn,
.retry-btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #19f342 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(25, 243, 66, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(25, 243, 66, 0.4);
}

.btn-secondary {
    background: rgba(247, 250, 252, 0.8);
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
    background: white;
    border-color: #cbd5e0;
}

.contact-btn,
.retry-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.contact-btn:hover,
.retry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Powered By */
.powered-by {
    text-align: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animaciones */
@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .conversational-demo {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .chat-input-area {
        padding: 16px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .time-slots {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
    
    .success-actions,
    .complete-actions {
        flex-direction: column;
    }
}

/* Estados adicionales */
.conversational-demo.loading {
    pointer-events: none;
}

.conversational-demo.error {
    border-color: #e53e3e;
}

.conversational-demo.success {
    border-color: #19f342;
}

/* Efectos de hover mejorados */
.conversational-demo:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

/* Transiciones suaves para todos los elementos interactivos */
* {
    transition: all 0.2s ease;
}

/* Mejoras de accesibilidad */
.conversational-demo *:focus {
    outline: 2px solid #19f342;
    outline-offset: 2px;
}

/* Personalización del scrollbar para Firefox */
.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}