/* widget.css - Estilos del Chatbot Gemind con Sistema de Feedback */
/* Ubicación: /chatbot/widget.css */

#gemind-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    z-index: 9999;
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Área de mensajes - CONTENEDOR */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #FAFAFA;
    scroll-behavior: smooth;
}

/* Mensaje individual */
.chat-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}
.chat-container {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #E4DBCE;
    transition: all 0.3s ease;
}

.chat-header {
    background: linear-gradient(135deg, #28A4AD 0%, #1e8890 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 20px 20px 0 0;
    cursor: move;
}

.chat-header img {
    height: 30px;
    filter: brightness(0) invert(1);
}

.chat-header span {
    flex: 1;
    font-weight: 600;
    font-size: 16px;
    user-select: none;
}

.chat-minimize {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.chat-minimize:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}


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

.user-message {
    align-items: flex-end;
}

.bot-message {
    align-items: flex-start;
    text-align: left;  /* Añadir esta línea si no está */
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
    display: inline-block;  /* Añadir esta línea */
}

.user-message .message-content {
    background: #28A4AD;
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: white;
    color: #413D45;
    border: 1px solid #E4DBCE;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: inline-block;  /* Importante para que se ajuste al contenido */
    min-width: auto;  /* Para que no tenga ancho mínimo */
    max-width: 80%;  /* Mantener el máximo */
}

/* NUEVOS ESTILOS PARA SISTEMA DE FEEDBACK */
.feedback-buttons {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    padding-left: 16px;
}

.feedback-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 16px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Nunito', sans-serif;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.feedback-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.feedback-btn.helpful:hover {
    border-color: #4CAF50;
    background: #e8f5e9;
    color: #2e7d32;
}

.feedback-btn.not-helpful:hover {
    border-color: #f44336;
    background: #ffebee;
    color: #c62828;
}

.feedback-received {
    color: #666;
    font-size: 12px;
    font-style: italic;
    padding-left: 16px;
    margin-top: 8px;
}

/* ESTILOS PARA FORMULARIO DE CONTACTO INLINE */
.contact-form-inline {
    background: linear-gradient(135deg, #f5f7fa 0%, #e6f4f5 100%);
    padding: 15px;
    border-radius: 12px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    max-width: 100%;
    animation: fadeIn 0.3s ease;
}

.contact-form-inline p {
    margin: 0 0 10px 0;
    color: #413D45;
    font-size: 13px;
    line-height: 1.4;
}

.contact-form-inline p strong {
    color: #28A4AD;
    font-size: 14px;
    display: block;
    margin-bottom: 5px;
}

.contact-form-inline .form-group {
    margin-bottom: 10px;
}

.contact-form-inline input,
.contact-form-inline textarea {
    width: calc(100% - 28px);  /* Ajustar para el padding */
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Nunito', sans-serif;
    transition: all 0.3s;
    background: white;
    box-sizing: border-box;
    display: block;
}

.contact-form-inline input:focus,
.contact-form-inline textarea:focus {
    outline: none;
    border-color: #28A4AD;
    box-shadow: 0 0 0 2px rgba(40, 164, 173, 0.1);
}

.contact-form-inline textarea {
    resize: vertical;
    min-height: 50px;
    max-height: 100px;
}

.contact-form-inline input::placeholder,
.contact-form-inline textarea::placeholder {
    color: #999;
    font-size: 12px;
}

.btn-send-specialist {
    background: linear-gradient(135deg, #28A4AD 0%, #1e8890 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    width: 100%;
    font-family: 'Nunito', sans-serif;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(40, 164, 173, 0.3);
    margin-top: 10px;
}

.btn-send-specialist:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 164, 173, 0.4);
}

.btn-send-specialist:active {
    transform: translateY(0);
}

.btn-send-specialist:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Para dispositivos móviles */
@media (max-width: 480px) {
    .contact-form-inline {
        padding: 12px;
    }
    
    .contact-form-inline input,
    .contact-form-inline textarea {
        font-size: 16px; /* Evitar zoom en iOS */
    }
}

/* ESTILOS EXISTENTES */
.chat-input-container {
    padding: 15px;
    border-top: 1px solid #E4DBCE;
    background: white;
    border-radius: 0 0 20px 20px;
}

.chat-form {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #E4DBCE;
    border-radius: 25px;
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input:focus {
    border-color: #28A4AD;
    box-shadow: 0 0 0 2px rgba(40, 164, 173, 0.1);
}

.chat-send {
    width: 40px;
    height: 40px;
    border: none;
    background: #28A4AD;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.chat-send:hover {
    background: #1e8890;
    transform: scale(1.05);
}

.chat-send:active {
    transform: scale(0.95);
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

.chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px;
    margin-bottom: 10px;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: #28A4AD;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.chat-typing span: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-suggestion {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px;
    background: white;
    border: 1px solid #28A4AD;
    color: #28A4AD;
    border-radius: 15px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    user-select: none;
}

.chat-suggestion:hover {
    background: #28A4AD;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(40, 164, 173, 0.2);
}

.escalate-notice {
    background: #FFF9E6;
    border-left: 3px solid #FAB53A;
    padding: 10px;
    margin: 10px 0;
    font-size: 13px;
    color: #7A6A00;
    border-radius: 5px;
}

/* Estado minimizado */
.chat-container.minimized {
    height: 60px;
    width: 100%;  /* Ocupar todo el widget */
    max-width: 380px;  /* Pero no más de 380px */
    animation: minimize 0.3s ease;
    position: fixed;
    bottom: 20px;
}

.chat-container.minimized .chat-messages {
    display: none;  /* Ocultar solo los mensajes */
}

.chat-container.minimized .chat-input-container {
    display: none;  /* Ocultar solo el input */
}

/* El header se mantiene visible */
.chat-container.minimized .chat-header {
    border-radius: 20px;  /* Redondear todo el header cuando está minimizado */
}
/* Cuando el widget está minimizado, ajustar su altura */
#gemind-chat-widget.widget-minimized {
    height: 60px;
    width: 380px !important;  /* Mantener el ancho original */
}
.chat-container.minimized .chat-header {
    border-radius: 20px;
    padding-right: 20px;  /* Asegurar espacio a la derecha */
    overflow: visible;  /* No cortar contenido */
    position: relative;  /* Para que el botón se posicione bien */
}

.chat-container.minimized .chat-minimize {
    position: absolute;
    right: 15px;  /* Ajustar posición desde el borde derecho */
    top: 50%;
    transform: translateY(-50%);  /* Centrar verticalmente */
}
@keyframes minimize {
    from {
        height: 600px;
    }
    to {
        height: 60px;
    }
}


/* Botón flotante cuando está cerrado */
.chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #28A4AD;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(40, 164, 173, 0.3);
    transition: all 0.3s;
    z-index: 9998;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(40, 164, 173, 0.4);
}

.chat-bubble svg {
    width: 30px;
    height: 30px;
    fill: white;
}

.chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #FAB53A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    font-weight: bold;
    animation: pulse 2s infinite;
}

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

/* Responsive */
@media (max-width: 480px) {
    #gemind-chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chat-container {
        border-radius: 0;
        height: 100vh;
        max-height: 100vh;
    }
    
    .chat-header {
        border-radius: 0;
    }
    
    .chat-bubble {
        bottom: 15px;
        right: 15px;
    }
    
    .contact-form-inline {
        padding: 15px;
    }
    
    .feedback-buttons {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .feedback-btn {
        width: fit-content;
    }
}

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

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

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

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

/* Animación de entrada del widget */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chat-container.opening {
    animation: slideInUp 0.3s ease;
}

/* Estados de carga */
.loading-spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #28A4AD;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Soporte para texto con formato */
.message-content strong {
    font-weight: 600;
    color: inherit;
}
/* Mensaje de bienvenida flotante */
.chat-welcome-message {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: white;
    border-radius: 12px;
    padding: 15px 45px 15px 15px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 320px;
    z-index: 9997;
    animation: slideInRight 0.5s ease;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.chat-welcome-message:hover {
    transform: translateX(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.welcome-avatar {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #28A4AD 0%, #1e8890 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(40, 164, 173, 0.3);
}

.welcome-avatar svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.welcome-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    font-family: 'Nunito', sans-serif;
}

.welcome-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.welcome-close:hover {
    color: #333;
    transform: scale(1.2);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Ocultar mensaje de bienvenida en móvil si es muy pequeño */
@media (max-width: 480px) {
    .chat-welcome-message {
        max-width: calc(100vw - 40px);
        font-size: 13px;
    }
}