/**
 * CSS del chatbot - Diseño responsive con colores de marca
 * Colores: #667eea, #764ba2
 */

/* Variables de colores */
:root {
    --amex-primary: #667eea;
    --amex-secondary: #764ba2;
    --amex-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --amex-light: #f8f9fa;
    --amex-dark: #343a40;
    --amex-border: #e9ecef;
    --amex-success: #28a745;
    --amex-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --amex-radius: 12px;
    --amex-transition: all 0.3s ease;
}

/* Botón flotante */
.amex-chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--amex-gradient);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--amex-shadow);
    z-index: 999998;
    transition: var(--amex-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    outline: none;
}

.amex-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.3);
}

.amex-chatbot-toggle.active {
    transform: rotate(360deg);
}

.amex-chatbot-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Ventana del chat */
.amex-chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 60px);
    height: 600px;
    max-height: calc(100vh - 130px);
    background: white;
    border-radius: var(--amex-radius);
    box-shadow: var(--amex-shadow);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Header */
.amex-chatbot-header {
    background: var(--amex-gradient);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.amex-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.amex-chatbot-avatar {
    font-size: 24px;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.amex-chatbot-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.amex-chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.amex-chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--amex-success);
    border-radius: 50%;
    display: inline-block;
}

.amex-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--amex-transition);
    outline: none;
}

.amex-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Área de mensajes */
.amex-chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--amex-light);
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
}

.amex-chatbot-message {
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.amex-chatbot-message-assistant {
    align-self: flex-start;
}

.amex-chatbot-message-user {
    align-self: flex-end;
}

.amex-chatbot-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.amex-chatbot-message-assistant .amex-chatbot-message-content {
    background: white;
    border: 1px solid var(--amex-border);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.amex-chatbot-message-user .amex-chatbot-message-content {
    background: var(--amex-primary);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.amex-chatbot-message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 5px;
    padding: 0 5px;
}

.amex-chatbot-message-user .amex-chatbot-message-time {
    text-align: right;
}

/* Videos embebidos */
.amex-chatbot-message-content .video-container {
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: black;
}

.amex-chatbot-message-content iframe {
    display: block;
    border: none;
    width: 100%;
    max-width: 240px;
}

/* Opciones */
.amex-chatbot-options {
    padding: 15px 20px;
    border-top: 1px solid var(--amex-border);
    background: white;
    flex-shrink: 0;
}

.amex-chatbot-options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.amex-chatbot-option {
    background: var(--amex-light);
    border: 1px solid var(--amex-border);
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: var(--amex-transition);
    color: var(--amex-dark);
    outline: none;
    font-family: inherit;
}

.amex-chatbot-option:hover {
    background: var(--amex-primary);
    color: white;
    border-color: var(--amex-primary);
    transform: translateY(-2px);
}

.amex-chatbot-option:active {
    transform: translateY(0);
}

.amex-chatbot-option:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.amex-chatbot-return {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
    margin-top: 5px;
}

/* Input de texto */
.amex-chatbot-input-container {
    padding: 15px 20px;
    border-top: 1px solid var(--amex-border);
    background: white;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.amex-chatbot-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--amex-border);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--amex-transition);
    font-family: inherit;
    outline: none;
}

.amex-chatbot-input:focus {
    outline: none;
    border-color: var(--amex-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.amex-chatbot-send {
    background: var(--amex-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 20px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--amex-transition);
    font-family: inherit;
    outline: none;
    white-space: nowrap;
}

.amex-chatbot-send:hover {
    background: var(--amex-secondary);
}

.amex-chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Footer */
.amex-chatbot-footer {
    padding: 10px 20px;
    background: var(--amex-light);
    border-top: 1px solid var(--amex-border);
    text-align: center;
    flex-shrink: 0;
}

.amex-chatbot-footer small {
    font-size: 11px;
    color: #6c757d;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    .amex-chatbot-window {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 80px;
        height: 500px;
        max-height: calc(100vh - 100px);
    }
    
    .amex-chatbot-toggle {
        right: 20px;
        bottom: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .amex-chatbot-message-content iframe {
        max-width: 200px;
        height: 280px;
    }
}

@media (max-width: 480px) {
    .amex-chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        height: 450px;
        max-height: calc(100vh - 80px);
    }
    
    .amex-chatbot-message {
        max-width: 90%;
    }
    
    .amex-chatbot-messages {
        padding: 15px;
    }
    
    .amex-chatbot-options,
    .amex-chatbot-input-container {
        padding: 10px 15px;
    }
    
    .amex-chatbot-message-content iframe {
        max-width: 180px;
        height: 240px;
    }
}

/* Animación de typing */
.amex-chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border: 1px solid var(--amex-border);
    width: fit-content;
    margin-bottom: 5px;
}

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

.amex-chatbot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.amex-chatbot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Scrollbar personalizada */
.amex-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.amex-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.amex-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 3px;
}

.amex-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* Enlaces dentro del chat */
.amex-chatbot-message-content a {
    color: var(--amex-primary);
    text-decoration: none;
    border-bottom: 1px dotted;
    transition: var(--amex-transition);
    word-break: break-all;
}

.amex-chatbot-message-content a:hover {
    color: var(--amex-secondary);
    border-bottom-style: solid;
}

/* Listas dentro del chat */
.amex-chatbot-message-content ul,
.amex-chatbot-message-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.amex-chatbot-message-content li {
    margin-bottom: 5px;
}

/* Texto en negrita */
.amex-chatbot-message-content strong {
    color: #333;
    font-weight: 600;
}

/* Estados del chat */
.amex-chatbot-loading {
    opacity: 0.7;
    pointer-events: none;
}

.amex-chatbot-hidden {
    display: none !important;
}
