/**
 * Lledó - Asistente de Castellón
 * Estilos CSS - Responsive corregido + Logo sin fondo blanco
 * Versión 2.2.4
 */

:root {
    --lledo-primary: #FFA85C;
    --lledo-primary-hover: #FF9944;
    --lledo-secondary: #FFB366;
    --lledo-bg: #ffffff;
    --lledo-bg-light: #FFF8F0;
    --lledo-text: #2c3e50;
    --lledo-gray: #6b7280;
    --lledo-light-gray: #f3f4f6;
    --lledo-border: #e1e8ed;
    --lledo-success: #10b981;
    --lledo-error: #ef4444;
    --lledo-shadow: 0 8px 32px rgba(255, 168, 92, 0.15);
    --lledo-shadow-lg: 0 20px 40px rgba(255, 168, 92, 0.2);
}

/* ========== Contenedor Principal ========== */
.lledo-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ========== Botón Flotante CIRCULAR CON ANIMACIÓN ========== */
.lledo-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFA85C 0%, #FF9944 50%, #FF8C2C 100%);
    border: none;
    cursor: pointer;
    box-shadow: var(--lledo-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    animation: lledo-bounce 2s ease-in-out infinite;
}

.lledo-chat-button:hover {
    transform: scale(1.05);
    box-shadow: var(--lledo-shadow-lg);
    animation: none;
    background: linear-gradient(135deg, #FFB366 0%, #FFA85C 50%, #FF9944 100%);
}

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

/* Animación de rebote suave */
@keyframes lledo-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.lledo-button-text {
    color: white;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Anillo pulsante naranja */
.lledo-pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--lledo-primary);
    animation: lledo-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes lledo-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

/* ========== Ventana de Chat ========== */
.lledo-chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 40px);
    background: var(--lledo-bg);
    border-radius: 16px;
    box-shadow: var(--lledo-shadow-lg);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lledo-chat-window.lledo-chat-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* ========== Header Naranja con Degradado ========== */
.lledo-chat-header {
    background: linear-gradient(135deg, #FFA85C 0%, #FF9944 50%, #FF8C2C 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lledo-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lledo-avatar {
    position: relative;
    width: 42px;
    height: 42px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.lledo-avatar-logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: contain;
}

.lledo-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--lledo-success);
    border: 2px solid white;
    border-radius: 50%;
}

.lledo-header-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.lledo-header-subtitle {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.lledo-close-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.lledo-close-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== Mensajes - Fondo Claro Naranja ========== */
.lledo-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--lledo-bg-light);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lledo-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.lledo-chat-messages::-webkit-scrollbar-thumb {
    background: var(--lledo-border);
    border-radius: 3px;
}

/* Mensaje de bienvenida */
.lledo-welcome-message {
    display: flex;
    gap: 12px;
    animation: lledo-fade-in 0.5s ease-out;
}

.lledo-welcome-avatar {
    width: 36px;
    height: 36px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.lledo-welcome-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: contain;
}

.lledo-welcome-content {
    background: white;
    padding: 14px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.lledo-welcome-content h4 {
    margin: 0 0 8px 0;
    color: var(--lledo-text);
    font-size: 16px;
}

.lledo-welcome-content p {
    margin: 0 0 12px 0;
    color: var(--lledo-gray);
    font-size: 14px;
    line-height: 1.5;
}

/* Sugerencias rápidas */
.lledo-quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.lledo-suggestion {
    background: var(--lledo-bg-light);
    border: 1px solid var(--lledo-border);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--lledo-text);
    cursor: pointer;
    transition: all 0.2s;
}

.lledo-suggestion:hover {
    background: linear-gradient(135deg, #FFA85C 0%, #FF9944 50%, #FF8C2C 100%);
    color: white;
    border-color: var(--lledo-primary);
}

/* Mensajes */
.lledo-message {
    display: flex;
    gap: 10px;
    opacity: 0;
    transform: translateY(10px);
    animation: lledo-fade-in 0.3s ease-out forwards;
}

.lledo-message-user {
    flex-direction: row-reverse;
}

.lledo-message-avatar {
    width: 32px;
    height: 32px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.lledo-message-avatar-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
}

.lledo-message-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.lledo-message-bubble {
    background: white;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--lledo-text);
    max-width: 100%;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.lledo-message-user .lledo-message-bubble {
    background: linear-gradient(135deg, #FFA85C 0%, #FF9944 50%, #FF8C2C 100%);
    color: white;
}

.lledo-message-error .lledo-message-bubble {
    background: #fee2e2;
    color: var(--lledo-error);
    border: 1px solid #fecaca;
}

.lledo-message-time {
    font-size: 11px;
    color: var(--lledo-gray);
    padding: 0 4px;
}

/* Indicador de escritura */
.lledo-typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border-radius: 16px;
    width: fit-content;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.lledo-typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--lledo-primary);
    border-radius: 50%;
    animation: lledo-typing 1.4s ease-in-out infinite;
}

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

.lledo-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* ========== Input ========== */
.lledo-chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid var(--lledo-border);
    background: var(--lledo-bg);
    display: flex;
    gap: 10px;
    align-items: center;
}

.lledo-chat-input {
    flex: 1;
    border: 1px solid var(--lledo-border);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.lledo-chat-input:focus {
    border-color: var(--lledo-primary);
    box-shadow: 0 0 0 3px rgba(255, 127, 17, 0.1);
}

.lledo-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFA85C 0%, #FF9944 50%, #FF8C2C 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.lledo-send-button:hover:not(:disabled) {
    transform: scale(1.1);
    background: linear-gradient(135deg, #FFB366 0%, #FFA85C 50%, #FF9944 100%);
}

.lledo-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Footer ========== */
.lledo-chat-footer {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid var(--lledo-border);
    background: var(--lledo-bg);
    font-size: 11px;
    color: var(--lledo-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== Animaciones ========== */
@keyframes lledo-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Responsive 100% ========== */

/* Tablets y móviles grandes (768px - 1024px) */
@media (max-width: 1024px) {
    .lledo-chat-window {
        width: 400px;
        max-width: 90vw;
        height: 600px;
        max-height: 80vh;
    }
}

/* Móviles medianos (481px - 767px) */
@media (max-width: 767px) {
    .lledo-chat-window {
        width: 380px;
        max-width: 95vw;
        height: 550px;
        max-height: 75vh;
        right: 20px;
        bottom: 20px;
    }
    
    .lledo-chat-button {
        right: 20px;
        bottom: 20px;
    }
}

/* Móviles pequeños (hasta 480px) */
@media (max-width: 480px) {
    .lledo-chat-window {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .lledo-chat-header {
        border-radius: 0;
    }
    
    .lledo-chat-button {
        right: 16px;
        bottom: 16px;
    }
}
