/* AgentBot IA - Chat Widget CSS */

/* Widget Container */
#agentbot-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

#agentbot-chat-widget.agentbot-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

#agentbot-chat-widget.agentbot-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Chat Button */
#agentbot-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: white;
}

#agentbot-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Chat Window */
#agentbot-chat-window {
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 90px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

#agentbot-chat-widget.agentbot-position-bottom-right #agentbot-chat-window {
    right: 20px;
}

#agentbot-chat-widget.agentbot-position-bottom-left #agentbot-chat-window {
    left: 20px;
}

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

/* Chat Header */
.agentbot-chat-header {
    padding: 20px;
    background: linear-gradient(135deg, #00BCD4 0%, #0097A7 100%); /* Cyan turquesa */
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.agentbot-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

#agentbot-clear-chat {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}

#agentbot-clear-chat:hover {
    opacity: 1;
    transform: scale(1.1);
}

#agentbot-chat-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#agentbot-chat-close:hover {
    opacity: 1;
}

/* Messages Container */
#agentbot-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

/* Message Styles */
.agentbot-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

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

.agentbot-message-content {
    padding: 14px 18px;
    border-radius: 20px; /* Más redondeado estilo Wellell */
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.5;
}

.agentbot-bot-message .agentbot-message-content {
    background: #F5F5F5; /* Gris claro como Wellell */
    color: #333;
    align-self: flex-start;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    border-bottom-left-radius: 4px; /* Detalle Wellell */
}

.agentbot-user-message .agentbot-message-content {
    background: #00BCD4; /* Cyan turquesa como Wellell */
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px; /* Detalle Wellell */
}

/* Input Area */
.agentbot-chat-input-wrapper {
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

#agentbot-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}

#agentbot-chat-input:focus {
    border-color: #0073aa;
}

#agentbot-chat-send {
    background: #00BCD4; /* Turquesa */
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    flex-shrink: 0;
}

#agentbot-chat-send svg {
    fill: white;
    width: 20px;
    height: 20px;
}

#agentbot-chat-send:hover {
    background: #0097A7;
    transform: scale(1.05);
}

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

/* Typing Indicator */
#agentbot-chat-typing {
    padding: 0 20px 16px;
    background: #f5f5f5;
}

#agentbot-chat-typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    margin-right: 4px;
    animation: typing 1.4s infinite;
}

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

#agentbot-chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Sources */
.agentbot-message-sources {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

.agentbot-message-sources a {
    color: #0073aa;
    text-decoration: none;
}

.agentbot-message-sources a:hover {
    text-decoration: underline;
}

/* Scrollbar */
#agentbot-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#agentbot-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#agentbot-chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#agentbot-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #agentbot-chat-window {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        bottom: 0;
        right: 0 !important;
        left: 0 !important;
    }
    
    #agentbot-chat-button {
        width: 56px;
        height: 56px;
    }
}

/* Formato de Especificaciones Técnicas */
.spec-title {
    margin: 0 0 12px 0;
    padding: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.spec-grid {
    display: grid;
    gap: 10px;
    margin: 12px 0;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #3498db;
    transition: all 0.2s;
}

.spec-item:hover {
    background: #e9ecef;
    transform: translateX(2px);
}

.spec-label {
    font-weight: 600;
    color: #495057;
    font-size: 13px;
}

.spec-value {
    color: #212529;
    font-size: 13px;
    text-align: right;
}

/* Mejorar mensajes con listas */
.agentbot-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.agentbot-message-content li {
    margin: 4px 0;
    line-height: 1.5;
}

.agentbot-message-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.agentbot-message-content strong {
    color: #2c3e50;
    font-weight: 600;
}

/* Responsive para especificaciones */
@media (max-width: 480px) {
    .spec-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .spec-value {
        text-align: left;
        font-size: 12px;
    }
    
    .spec-label {
        font-size: 12px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   🎯 ESTILOS PARA FLUJOS CONVERSACIONALES Y PRODUCTOS
   ═══════════════════════════════════════════════════════════════ */

/* Contenedor de preguntas */
.agentbot-question-container {
    margin: 10px 0;
}

/* Barra de progreso */
.agentbot-progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.agentbot-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0EA5E9 0%, #06B6D4 100%);
    transition: width 0.3s ease;
}

.agentbot-progress-text {
    font-size: 12px;
    color: #666;
    margin: 5px 0 10px 0;
}

/* Texto de pregunta */
.agentbot-question-text {
    font-size: 15px;
    margin-bottom: 12px;
    color: #333;
}

/* Opciones como botones */
.agentbot-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agentbot-option-btn {
    padding: 12px 16px;
    background: white;
    border: 2px solid #0EA5E9;
    border-radius: 8px;
    color: #0EA5E9;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.agentbot-option-btn:hover {
    background: #F0F9FF;
    border-color: #0284C7;
    transform: translateX(4px);
}

.agentbot-option-btn.selected {
    background: #0EA5E9;
    color: white;
    border-color: #0EA5E9;
}

.agentbot-option-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════
   🎨 CARDS DE PRODUCTOS
   ═══════════════════════════════════════════════════════════════ */

.agentbot-products-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
    width: 100%;
    max-width: none;
}

.agentbot-product-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
}

.agentbot-product-card:hover {
    border-color: #0EA5E9;
    box-shadow: 0 4px 16px rgba(14,165,233,0.2);
    transform: translateY(-2px);
}

/* Badge de compatibilidad */
.agentbot-product-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: white;
}

.agentbot-product-badge.high {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.agentbot-product-badge.medium {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

.agentbot-product-badge.low {
    background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
}

/* Imagen del producto */
.agentbot-product-image {
    width: 100%;
    height: 180px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #F9FAFB;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agentbot-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Título del producto */
.agentbot-product-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 12px 0;
    padding-right: 100px; /* Espacio para el badge */
}

/* Lista de características */
.agentbot-product-features {
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
}

.agentbot-product-features li {
    padding: 6px 0;
    font-size: 14px;
    color: #4B5563;
    border-bottom: 1px solid #F3F4F6;
}

.agentbot-product-features li:last-child {
    border-bottom: none;
}

.agentbot-product-features li:before {
    content: "✓";
    color: #10B981;
    font-weight: bold;
    margin-right: 8px;
}

/* Precio */
.agentbot-product-price {
    font-size: 24px;
    font-weight: 800;
    color: #0EA5E9;
    margin: 12px 0;
}

/* Botones de acción */
.agentbot-product-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.agentbot-btn-primary,
.agentbot-btn-secondary {
    flex: 1;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    border: none;
}

.agentbot-btn-primary {
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    color: white;
}

.agentbot-btn-primary:hover {
    background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14,165,233,0.3);
}

.agentbot-btn-secondary {
    background: white;
    color: #0EA5E9;
    border: 2px solid #0EA5E9;
}

.agentbot-btn-secondary:hover {
    background: #F0F9FF;
    border-color: #0284C7;
}

/* Responsive */
@media (max-width: 480px) {
    .agentbot-products-container {
        gap: 12px;
    }
    
    .agentbot-product-card {
        padding: 12px;
    }
    
    .agentbot-product-title {
        font-size: 16px;
        padding-right: 90px;
    }
    
    .agentbot-product-badge {
        font-size: 11px;
        padding: 4px 8px;
        top: 8px;
        right: 8px;
    }
    
    .agentbot-product-image {
        height: 150px;
    }
    
    .agentbot-product-price {
        font-size: 20px;
    }
    
    .agentbot-product-actions {
        flex-direction: column;
    }
    
    .agentbot-btn-primary,
    .agentbot-btn-secondary {
        width: 100%;
    }
}

/* Botones de intención inicial */
.agentbot-initial-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agentbot-intent-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #0EA5E9 0%, #06B6D4 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.agentbot-intent-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.agentbot-intent-btn:active {
    transform: translateY(0);
}

/* Botones de tipo de producto */
.agentbot-product-btn {
    padding: 12px 20px;
    background: white;
    color: #0EA5E9;
    border: 2px solid #0EA5E9;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.agentbot-product-btn:hover {
    background: #F0F9FF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.agentbot-product-btn:active {
    transform: translateY(0);
}

/* Botones de WhatsApp y Llamar */
.agentbot-btn-whatsapp {
    background: #25D366 !important;
    color: white !important;
    border: none !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-block !important;
    margin: 4px !important;
}

.agentbot-btn-whatsapp:hover {
    background: #1FB855 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3) !important;
}

.agentbot-btn-call {
    background: #007BFF !important;
    color: white !important;
    border: none !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-block !important;
    margin: 4px !important;
}

.agentbot-btn-call:hover {
    background: #0056B3 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3) !important;
}

/* Productos ocultos */
.agentbot-hidden-product {
    display: none !important;
}

/* Botón Ver más */
.agentbot-show-more-wrapper {
    text-align: center;
    margin: 16px 0;
}

.agentbot-show-more-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.agentbot-show-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Placeholder de imagen */
.agentbot-no-image {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    font-size: 48px;
    margin-bottom: 16px;
}

/* Mejorar botón primario */
.agentbot-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    width: 100% !important;
    margin-bottom: 8px !important;
    font-size: 15px !important;
    padding: 12px !important;
}

/* Grid de botones secundarios */
.agentbot-product-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.agentbot-product-actions .agentbot-btn-primary {
    flex: 1 1 100%;
    width: 100%;
}

.agentbot-product-actions-secondary {
    display: flex;
    gap: 8px;
}

.agentbot-product-actions-secondary .agentbot-btn-whatsapp,
.agentbot-product-actions-secondary .agentbot-btn-call {
    flex: 1 1 calc(50% - 4px);
}

/* Card ancho completo */
.agentbot-product-card {
    width: 100% !important;
    max-width: none !important;
}

.agentbot-products-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   📝 INPUTS NUMÉRICOS Y TEXTO
   ═══════════════════════════════════════════════════════════════ */

.agentbot-number-input,
.agentbot-text-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
}

.agentbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #0EA5E9;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.agentbot-input:focus {
    outline: none;
    border-color: #0284C7;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.agentbot-unit {
    font-weight: 600;
    color: #64748B;
    font-size: 16px;
}

.agentbot-submit-btn {
    padding: 12px 24px;
    background: #0EA5E9;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.agentbot-submit-btn:hover {
    background: #0284C7;
    transform: translateX(2px);
}

.agentbot-submit-btn:disabled {
    background: #CBD5E1;
    cursor: not-allowed;
    transform: none;
}

.agentbot-question-help {
    color: #64748B;
    font-size: 13px;
    margin: 8px 0 15px 0;
    font-style: italic;
}

/* Fix para botón ENVIAR visible */
.agentbot-submit-btn {
    background: #E53E3E !important; /* Rojo vibrante */
    color: white !important;
}

.agentbot-submit-btn:hover {
    background: #C53030 !important; /* Rojo más oscuro */
}

.agentbot-submit-btn:disabled {
    background: #CBD5E1 !important; /* Gris cuando disabled */
    color: #94A3B8 !important;
}
