/**
 * ChatBot HLan - Frontend CSS
 * Generado dinámicamente con variables CSS
 */

/* Contenedor principal */
#chatbothlan-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--chatbothlan-font-size);
    line-height: 1.5;
}

.chatbothlan-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.chatbothlan-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Botón flotante */
.chatbothlan-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--chatbothlan-primary);
    color: var(--chatbothlan-text-color);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.chatbothlan-toggle-btn:hover {
    background: var(--chatbothlan-secondary);
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.chatbothlan-toggle-btn:active {
    transform: scale(0.95);
}

/* Ventana del chat */
.chatbothlan-window {
    position: absolute;
    bottom: 70px;
    width: var(--chatbothlan-chat-width);
    height: var(--chatbothlan-chat-height);
    background: var(--chatbothlan-bg);
    border-radius: var(--chatbothlan-border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatbothlan-slide-up 0.3s ease;
}

.chatbothlan-position-bottom-left .chatbothlan-window {
    right: auto;
    left: 0;
}

.chatbothlan-position-bottom-right .chatbothlan-window {
    right: 0;
    left: auto;
}

@keyframes chatbothlan-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cabecera */
.chatbothlan-header {
    background: #ffffff;
    color: #274E4E;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 3px solid var(--chatbothlan-primary);
}

.chatbothlan-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbothlan-logo {
    height: 32px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.chatbothlan-status {
    font-size: 11px;
    opacity: 0.85;
}

.chatbothlan-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: all 0.2s;
}

.chatbothlan-close-btn:hover {
    opacity: 1;
    color: #dc2626;
    background: #fef2f2;
}

/* Área de mensajes */
.chatbothlan-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.chatbothlan-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbothlan-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbothlan-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Burbujas de mensaje */
.chatbothlan-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: chatbothlan-fade-in 0.3s ease;
}

@keyframes chatbothlan-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbothlan-message-user {
    align-self: flex-end;
}

.chatbothlan-message-bot {
    align-self: flex-start;
}

.chatbothlan-message-bubble {
    padding: 10px 14px;
    border-radius: var(--chatbothlan-border-radius);
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

.chatbothlan-message-user .chatbothlan-message-bubble {
    background: var(--chatbothlan-user-msg);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chatbothlan-message-bot .chatbothlan-message-bubble {
    background: var(--chatbothlan-bot-msg);
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.chatbothlan-message-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
}

.chatbothlan-message-user .chatbothlan-message-time {
    text-align: right;
}

/* Indicador de escritura */
.chatbothlan-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    margin: 0 16px;
    background: var(--chatbothlan-bot-msg);
    border-radius: var(--chatbothlan-border-radius);
    border-bottom-left-radius: 4px;
    width: fit-content;
    max-width: 60px;
}

.chatbothlan-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: chatbothlan-bounce 1.4s infinite ease-in-out both;
}

.chatbothlan-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chatbothlan-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.chatbothlan-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes chatbothlan-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Área de entrada */
.chatbothlan-input-area {
    padding: 12px 16px;
    background: var(--chatbothlan-bubble);
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.chatbothlan-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: calc(var(--chatbothlan-border-radius) - 4px);
    padding: 10px 12px;
    font-size: var(--chatbothlan-font-size);
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 100px;
    line-height: 1.4;
    transition: border-color 0.2s;
}

.chatbothlan-input:focus {
    border-color: var(--chatbothlan-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.chatbothlan-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--chatbothlan-primary);
    color: var(--chatbothlan-text-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.chatbothlan-send-btn:hover {
    background: var(--chatbothlan-secondary);
    transform: scale(1.05);
}

.chatbothlan-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Mensaje de error */
.chatbothlan-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
    margin: 8px 16px;
}

/* Responsive */
@media (max-width: 480px) {
    .chatbothlan-window {
        width: calc(100vw - 20px) !important;
        height: calc(100vh - 140px) !important;
        right: -10px !important;
        left: -10px !important;
        bottom: 70px;
    }

    #chatbothlan-container {
        right: 10px !important;
        left: auto !important;
    }
}
