#cbf-chatbot-container { position: fixed; bottom: 20px; right: 20px; z-index: 999999; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
#cbf-chat-toggle { width: 60px; height: 60px; background: linear-gradient(135deg, #667eea, #764ba2); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 15px rgba(102,126,234,0.4); transition: all 0.3s; }
#cbf-chat-toggle:hover { transform: scale(1.1); }
.cbf-toggle-icon, .cbf-toggle-close { font-size: 26px; color: white; }
#cbf-chat-window { position: absolute; bottom: 75px; right: 0; width: 360px; height: 520px; background: #fff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); display: flex; flex-direction: column; overflow: hidden; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.cbf-chat-header { background: linear-gradient(135deg, #667eea, #764ba2); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; }
.cbf-header-info { display: flex; align-items: center; gap: 10px; }
.cbf-chat-avatar { font-size: 24px; }
.cbf-chat-title { color: white; font-weight: 600; font-size: 15px; }
.cbf-header-buttons { display: flex; gap: 8px; }
.cbf-header-buttons button, .cbf-whatsapp-btn { background: rgba(255,255,255,0.2); border: none; color: white; font-size: 16px; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; text-decoration: none; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.cbf-whatsapp-btn { background: #25d366; }
.cbf-whatsapp-btn:hover { background: #128c7e; }
.cbf-header-buttons button:hover { background: rgba(255,255,255,0.3); }
#cbf-chat-messages { flex: 1; overflow-y: auto; padding: 15px; background: #f5f5f7; display: flex; flex-direction: column; gap: 10px; }
#cbf-chat-messages::-webkit-scrollbar { width: 4px; }
#cbf-chat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.cbf-message { max-width: 80%; padding: 10px 15px; border-radius: 15px; font-size: 14px; line-height: 1.5; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.cbf-message.bot { background: white; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.cbf-message.user { background: linear-gradient(135deg, #667eea, #764ba2); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.cbf-typing { display: flex; gap: 4px; padding: 12px 15px; background: white; border-radius: 15px; align-self: flex-start; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.cbf-typing-dot { width: 8px; height: 8px; background: #ccc; border-radius: 50%; animation: bounce 1.4s infinite; }
.cbf-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.cbf-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.6); } 40% { transform: scale(1); } }
#cbf-chat-buttons { padding: 15px; background: white; border-top: 1px solid #eee; display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }

/* BOTONES DE UN SOLO COLOR */
.cbf-chat-btn { padding: 10px 14px; border: 2px solid #667eea; background: white; color: #667eea; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; transition: all 0.2s; }
.cbf-chat-btn:hover { background: #667eea; color: white; transform: translateY(-1px); }

/* FORMULARIO DE EMAIL */
.cbf-email-form { background: white; padding: 15px; border-radius: 10px; margin-top: 10px; }
.cbf-email-form input, .cbf-email-form textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 10px; font-size: 14px; box-sizing: border-box; }
.cbf-email-form textarea { min-height: 80px; resize: vertical; }
.cbf-email-form input:focus, .cbf-email-form textarea:focus { border-color: #667eea; outline: none; }
.cbf-email-form button { width: 100%; padding: 12px; background: #667eea; color: white; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.cbf-email-form button:hover { background: #5a6fd6; }
.cbf-email-form button:disabled { background: #ccc; cursor: not-allowed; }
.cbf-email-success { background: #d4edda; color: #155724; padding: 10px; border-radius: 8px; text-align: center; margin-top: 10px; }
.cbf-email-error { background: #f8d7da; color: #721c24; padding: 10px; border-radius: 8px; text-align: center; margin-top: 10px; }

.cbf-chat-end-msg { text-align: center; color: #888; font-size: 13px; padding: 8px; }
.cbf-restart-link { color: #667eea; cursor: pointer; text-decoration: underline; font-weight: 600; }
.cbf-restart-link:hover { color: #764ba2; }

/*
@media (max-width: 480px) { #cbf-chat-window { width: calc(100vw - 30px); height: calc(100vh - 100px); bottom: 70px; } }
*/


/* RESPONSIVE - MÓVIL */
@media (max-width: 480px) {
    #cbf-chatbot-container {
        bottom: 10px;
        right: 10px;
    }
    
    #cbf-chat-toggle {
        width: 55px;
        height: 55px;
    }
    
    #cbf-chat-window {
        position: fixed;
        top: 10px;
        bottom: 75px;
        right: 10px;
        left: 10px;
        width: auto;
        height: auto;
        max-height: calc(100vh - 90px);
        border-radius: 12px;
    }
    
    .cbf-chat-header {
        padding: 12px 15px;
    }
    
    .cbf-chat-title {
        font-size: 14px;
    }
    
    .cbf-header-buttons button,
    .cbf-whatsapp-btn,
    .cbf-email-btn {
        width: 28px;
        height: 28px;
    }
    
    .cbf-header-buttons svg {
        width: 14px;
        height: 14px;
    }
    
    #cbf-chat-messages {
        padding: 12px;
    }
    
    .cbf-message {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    #cbf-chat-buttons {
        padding: 10px;
        max-height: 180px;
    }
    
    .cbf-chat-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .cbf-email-form input,
    .cbf-email-form textarea {
        padding: 8px;
        font-size: 13px;
    }
    
    .cbf-email-form textarea {
        min-height: 60px;
    }
    
    .cbf-email-form button {
        padding: 10px;
        font-size: 13px;
    }
}

/* PANTALLAS MUY PEQUEÑAS */
@media (max-width: 360px) {
    #cbf-chat-window {
        top: 5px;
        bottom: 70px;
        right: 5px;
        left: 5px;
    }
    
    .cbf-chat-title {
        font-size: 13px;
    }
    
    .cbf-header-buttons {
        gap: 5px;
    }
}

/* MODO PAISAJE EN MÓVIL */
@media (max-height: 500px) {
    #cbf-chat-window {
        top: 5px;
        bottom: 65px;
        max-height: calc(100vh - 75px);
    }
    
    #cbf-chat-buttons {
        max-height: 120px;
    }
}


/* Bot贸n de Email */
.cbf-email-btn {
    background: #ea4335;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cbf-email-btn:hover {
    background: #c5221f;
}

/* Logo personalizado */
.cbf-chat-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}


/* ==================== ICONO IMAGEN EN BOTÓN FLOTANTE ==================== */
.cbf-toggle-img {
    width: 35px;
    height: 35px;
    object-fit: contain;
}

/* ==================== MODO OSCURO ==================== */
.cbf-dark-mode #cbf-chat-messages {
    background: #1a1a2e;
}

.cbf-dark-mode .cbf-message.bot {
    background: #2d2d44;
    color: #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.cbf-dark-mode .cbf-typing {
    background: #2d2d44;
}

.cbf-dark-mode .cbf-typing-dot {
    background: #666;
}

.cbf-dark-mode #cbf-chat-buttons {
    background: #16162a;
    border-top-color: #2d2d44;
}

.cbf-dark-mode .cbf-chat-btn {
    background: #2d2d44;
    border-color: #667eea;
    color: #a0a0ff;
}

.cbf-dark-mode .cbf-chat-btn:hover {
    background: #667eea;
    color: white;
}

.cbf-dark-mode .cbf-chat-end-msg {
    color: #888;
}

.cbf-dark-mode .cbf-restart-link {
    color: #a0a0ff;
}

.cbf-dark-mode .cbf-email-form {
    background: #2d2d44;
}

.cbf-dark-mode .cbf-email-form input,
.cbf-dark-mode .cbf-email-form textarea {
    background: #1a1a2e;
    border-color: #444;
    color: #e0e0e0;
}

.cbf-dark-mode .cbf-email-form input::placeholder,
.cbf-dark-mode .cbf-email-form textarea::placeholder {
    color: #888;
}

.cbf-dark-mode .cbf-email-form input:focus,
.cbf-dark-mode .cbf-email-form textarea:focus {
    border-color: #667eea;
}

.cbf-dark-mode .cbf-email-success {
    background: #1a4d1a;
    color: #90ee90;
}

.cbf-dark-mode .cbf-email-error {
    background: #4d1a1a;
    color: #ff9090;
}

/* Scrollbar en modo oscuro */
.cbf-dark-mode #cbf-chat-messages::-webkit-scrollbar-thumb {
    background: #444;
}

.cbf-dark-mode #cbf-chat-buttons::-webkit-scrollbar-thumb {
    background: #444;
}

/* ==================== POSICIÓN IZQUIERDA ==================== */
.cbf-position-left {
    left: 20px;
    right: auto;
}

.cbf-position-left #cbf-chat-toggle {
    /* El botón ya está bien */
}

.cbf-position-left #cbf-chat-window {
    left: 0;
    right: auto;
}

/* Responsive para posición izquierda */
@media (max-width: 480px) {
    .cbf-position-left {
        left: 10px;
        right: auto;
    }
    
    .cbf-position-left #cbf-chat-window {
        left: 10px;
        right: 10px;
    }
}

/* ==================== BURBUJA DE BIENVENIDA ==================== */
.cbf-welcome-bubble {
    position: absolute;
    bottom: 75px;
    right: 0;
    background: white;
    padding: 12px 35px 12px 15px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-size: 14px;
    color: #333;
    max-width: 220px;
    line-height: 1.4;
    animation: cbf-bubble-in 0.4s ease;
    z-index: 999998;
}

@keyframes cbf-bubble-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Triangulo de la burbuja */
.cbf-welcome-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 25px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

/* Triangulo cuando está a la izquierda */
.cbf-position-left .cbf-welcome-bubble {
    left: 0;
    right: auto;
}

.cbf-position-left .cbf-welcome-bubble::after {
    right: auto;
    left: 25px;
}

/* Botón cerrar */
.cbf-bubble-close {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    font-weight: normal;
}

.cbf-bubble-close:hover {
    color: #333;
}

.cbf-bubble-text {
    display: block;
    padding-right: 5px;
}

/* Modo oscuro para burbuja */
.cbf-dark-mode .cbf-welcome-bubble {
    background: #2d2d44;
    color: #e0e0e0;
}

.cbf-dark-mode .cbf-welcome-bubble::after {
    border-top-color: #2d2d44;
}

.cbf-dark-mode .cbf-bubble-close {
    color: #999;
}

.cbf-dark-mode .cbf-bubble-close:hover {
    color: #e0e0e0;
}

/* Responsive */
@media (max-width: 480px) {
    .cbf-welcome-bubble {
        max-width: 180px;
        font-size: 13px;
        padding: 10px 30px 10px 12px;
    }
}

/* ==================== OCULTAR EN MÓVIL ==================== */
@media (max-width: 768px) {
    .cbf-hide-mobile {
        display: none !important;
    }
}


/* ==================== POWERED BY ==================== */
.cbf-chat-footer {
    text-align: center;
    padding: 6px 10px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.cbf-chat-footer a {
    color: #999;
    text-decoration: none;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.cbf-chat-footer a:hover {
    color: #667eea;
}

.cbf-chat-footer a strong {
    color: #667eea;
    font-weight: 700;
}

/* Modo oscuro */
.cbf-dark-mode .cbf-chat-footer {
    background: #16162a;
    border-top-color: #2d2d44;
}

.cbf-dark-mode .cbf-chat-footer a {
    color: #666;
}

.cbf-dark-mode .cbf-chat-footer a:hover {
    color: #a0a0ff;
}

.cbf-dark-mode .cbf-chat-footer a strong {
    color: #a0a0ff;
}
