/**
 * WC AI Homeopathic Chat - Styles
 * Version: 2.1.0
 */

/* Container principal */
#wc-ai-homeopathic-chat-container {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Posiciones */
#wc-ai-homeopathic-chat-container.wc-ai-chat-position-right {
    right: 20px;
}

#wc-ai-homeopathic-chat-container.wc-ai-chat-position-left {
    left: 20px;
}

/* Botón flotante ORIGINAL */
.wc-ai-chat-launcher {
    position: relative;
    cursor: pointer;
    z-index: 1000;
}

.wc-ai-chat-launcher .wc-ai-chat-icon {
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
}

.wc-ai-chat-launcher:hover .wc-ai-chat-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.6);
}

/* Pulso del botón flotante */
.wc-ai-chat-pulse {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid #25D366;
    border-radius: 50%;
    animation: wc-ai-pulse 2s infinite;
    opacity: 0;
}

@keyframes wc-ai-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    70% {
        transform: scale(1.3);
        opacity: 0;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Ventana del chat */
.wc-ai-chat-window {
    position: absolute;
    bottom: 80px;
    width: 350px;
    max-width: 90vw;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
    overflow: hidden;
}

.wc-ai-chat-position-right .wc-ai-chat-window {
    right: 0;
}

.wc-ai-chat-position-left .wc-ai-chat-window {
    left: 0;
}

.wc-ai-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.wc-ai-chat-window.minimized {
    height: 60px !important;
    min-height: 60px !important;
}

.wc-ai-chat-window.minimized .wc-ai-chat-messages,
.wc-ai-chat-window.minimized .wc-ai-chat-input-container {
    display: none;
}

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

.wc-ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Avatar ORIGINAL */
.wc-ai-chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    backdrop-filter: blur(10px);
}

.wc-ai-chat-title h4 {
    margin: 0 0 2px 0;
    font-size: 16px;
    font-weight: 600;
}

.wc-ai-chat-status {
    font-size: 12px;
    opacity: 0.9;
    color: #a0f0a0;
}

/* Botones de acción con SVG */
.wc-ai-chat-actions {
    display: flex;
    gap: 5px;
}

.wc-ai-chat-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.wc-ai-chat-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Iconos SVG */
.wc-ai-icon-svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.wc-ai-chat-minimize:hover .wc-ai-icon-svg {
    transform: scale(1.2);
}

.wc-ai-chat-close:hover .wc-ai-icon-svg {
    transform: rotate(90deg) scale(1.2);
}

/* Área de mensajes */
.wc-ai-chat-messages {
    height: 350px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 transparent;
}

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

.wc-ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.wc-ai-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.wc-ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mensajes individuales */
.wc-ai-chat-message {
    margin-bottom: 16px;
    animation: wc-ai-message-appear 0.3s ease;
}

@keyframes wc-ai-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wc-ai-chat-message.user {
    text-align: right;
}

.wc-ai-chat-message.user .wc-ai-message-content {
    background: #667eea;
    color: white;
    margin-left: auto;
}

.wc-ai-chat-message.bot .wc-ai-message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
}

.wc-ai-message-content {
    display: inline-block;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    line-height: 1.4;
}

.wc-ai-message-content p {
    margin: 0 0 8px 0;
}

.wc-ai-message-content p:last-child {
    margin-bottom: 0;
}

.wc-ai-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wc-ai-chat-message.user .wc-ai-message-time {
    justify-content: flex-end;
}

/* Contenedor de input */
.wc-ai-chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e1e5e9;
}

.wc-ai-chat-input {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 12px;
}

.wc-ai-chat-input textarea {
    flex: 1;
    border: 1px solid #e1e5e9;
    border-radius: 20px;
    padding: 12px 16px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    transition: border-color 0.3s ease;
    background: #f8f9fa;
}

.wc-ai-chat-input textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.wc-ai-chat-input textarea::placeholder {
    color: #999;
}

/* Botón de enviar */
.wc-ai-chat-send {
    background: #667eea;
    border: none;
    color: white;
    padding: 12px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wc-ai-chat-send:hover:not(:disabled) {
    background: #5a6fd8;
    transform: scale(1.05);
}

.wc-ai-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.wc-ai-send-icon {
    font-size: 16px;
    font-weight: bold;
}

/* Fallback de WhatsApp */
.wc-ai-chat-fallback {
    text-align: center;
}

.wc-ai-whatsapp-fallback {
    background: #25D366;
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.wc-ai-whatsapp-fallback:hover {
    background: #128C7E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.wc-ai-whatsapp-icon {
    font-size: 16px;
}

/* Enlace de WhatsApp en mensajes */
.wc-ai-whatsapp-link {
    display: inline-block;
    background: #25D366;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.wc-ai-whatsapp-link:hover {
    background: #128C7E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

/* Loading */
.wc-ai-chat-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-style: italic;
}

.loading-dots {
    display: flex;
    gap: 3px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    animation: wc-ai-loading-bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes wc-ai-loading-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Estados responsivos */
@media (max-width: 480px) {
    #wc-ai-homeopathic-chat-container {
        bottom: 10px;
    }
    
    #wc-ai-homeopathic-chat-container.wc-ai-chat-position-right {
        right: 10px;
    }
    
    #wc-ai-homeopathic-chat-container.wc-ai-chat-position-left {
        left: 10px;
    }
    
    .wc-ai-chat-window {
        width: calc(100vw - 20px);
        max-width: none;
        bottom: 70px;
    }
    
    .wc-ai-chat-messages {
        height: 300px;
        max-height: 40vh;
    }
    
    .wc-ai-message-content {
        max-width: 90%;
    }
}

/* Animación de entrada del chat */
@keyframes wc-ai-chat-entrance {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.wc-ai-chat-window.active {
    animation: wc-ai-chat-entrance 0.3s ease;
}

/* Mejoras de accesibilidad */
.wc-ai-chat-actions button:focus,
.wc-ai-chat-send:focus,
.wc-ai-whatsapp-fallback:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.wc-ai-chat-input textarea:focus {
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

/* Estados de interactividad */
.wc-ai-chat-launcher.active .wc-ai-chat-icon {
    background: #128C7E;
}

/* Smooth transitions para todos los elementos interactivos */
.wc-ai-chat-launcher,
.wc-ai-chat-actions button,
.wc-ai-chat-send,
.wc-ai-whatsapp-fallback,
.wc-ai-chat-input textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}