/* Botón flotante del chat */
.ynsure-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 9998;
}

.ynsure-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.ynsure-chat-button img {
    width: 32px;
    height: 32px;
    filter: brightness(0) invert(1);
}

/* Ventana del chat */
.ynsure-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ynsure-chat-window.hidden {
    display: none;
}

/* Header del chat */
.ynsure-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ynsure-chat-header h4 {
    margin: 0;
    font-size: 16px;
}

.ynsure-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ynsure-chat-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Área de mensajes */
.ynsure-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Mensajes individuales */
.ynsure-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

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

.ynsure-message.user {
    background: #667eea;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ynsure-message.bot {
    background: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Indicador de escritura */
.ynsure-typing {
    background: white;
    padding: 10px 14px;
    border-radius: 18px;
    align-self: flex-start;
    display: flex;
    gap: 4px;
}

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

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

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

/* Input del chat */
.ynsure-chat-input-container {
    padding: 12px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
}

.ynsure-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
}

.ynsure-chat-input:focus {
    border-color: #667eea;
}

.ynsure-chat-send {
    background: #667eea;
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.ynsure-chat-send:hover {
    background: #5a67d8;
}

/* Responsive */
@media (max-width: 480px) {
    .ynsure-chat-window {
        width: calc(100vw - 48px);
        right: 24px;
        left: 24px;
        height: 60vh;
    }
}