/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   FloatClient Pro - Frontend Styles
   AI Chat Modal, WhatsApp Handover & Triggers
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â”€â”€â”€ Ventana Flotante del Chat de IA â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#floatclient-ai-window, #floatchat-ai-window {
    position: fixed;
    z-index: 100000;
    width: 360px;
    max-width: calc(100vw - 30px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Posicionamiento respecto a la posición configurada */
#floatclient-widget.fc-pos-bottom-right ~ #floatclient-ai-window,
#floatchat-widget.fc-pos-bottom-right ~ #floatchat-ai-window,
.fc-pos-bottom-right #floatclient-ai-window,
.fc-pos-bottom-right #floatchat-ai-window {
    right: var(--fc-mx, 20px);
    bottom: calc(var(--fc-my, 20px) + var(--fc-btn-size, 60px) + 16px);
}

#floatclient-widget.fc-pos-bottom-left ~ #floatclient-ai-window,
#floatchat-widget.fc-pos-bottom-left ~ #floatchat-ai-window,
.fc-pos-bottom-left #floatclient-ai-window,
.fc-pos-bottom-left #floatchat-ai-window {
    left: var(--fc-mx, 20px);
    bottom: calc(var(--fc-my, 20px) + var(--fc-btn-size, 60px) + 16px);
}

#floatclient-ai-window.fc-ai-open,
#floatchat-ai-window.fc-ai-open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* â”€â”€â”€ Cabecera del Chat â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.fc-ai-header {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.fc-ai-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.fc-ai-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.fc-ai-title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}
.fc-ai-status {
    font-size: 11px;
    color: #a5b4fc;
    margin-top: 2px;
}
.fc-ai-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.fc-ai-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

/* â”€â”€â”€ Cuerpo de Mensajes â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.fc-ai-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}
.fc-ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fcFadeInUp 0.25s ease-out;
}
.fc-ai-msg--bot {
    align-self: flex-start;
}
.fc-ai-msg--user {
    align-self: flex-end;
}

.fc-ai-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    word-break: break-word;
}
.fc-ai-msg--bot .fc-ai-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.fc-ai-msg--user .fc-ai-bubble {
    background: #4f46e5;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Indicador de escribiendo... */
.fc-ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}
.fc-ai-typing span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: fcDotBounce 1.2s infinite ease-in-out;
}
.fc-ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.fc-ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes fcDotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

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

/* â”€â”€â”€ BotÃ³n de Traspaso a WhatsApp â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.fc-ai-wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 12px;
    background: #25D366;
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.15s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
}
.fc-ai-wa-btn:hover {
    background: #1ebc59;
    transform: translateY(-1px);
}
.fc-ai-wa-btn svg {
    flex-shrink: 0;
}

/* â”€â”€â”€ Pie de Input â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.fc-ai-footer {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.fc-ai-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.fc-ai-input {
    flex: 1;
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 0 16px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.fc-ai-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}
.fc-ai-send-btn {
    width: 40px;
    height: 40px;
    background: #4f46e5;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    flex-shrink: 0;
}
.fc-ai-send-btn:hover {
    background: #4338ca;
    transform: scale(1.05);
}
.fc-ai-send-btn:active {
    transform: scale(0.95);
}
.fc-ai-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ─── Pre-Chat Lead Capture Form ────────────────────────────── */
.fc-prechat-wrap {
    padding: 18px;
    background: #ffffff;
    border-radius: 14px;
    margin: 8px 0;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.fc-prechat-title {
    font-weight: 700;
    font-size: 15px;
    color: #1e293b;
    margin: 0;
}
.fc-prechat-subtitle {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 4px;
    line-height: 1.4;
}
.fc-prechat-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fc-prechat-field label {
    font-size: 11.5px;
    font-weight: 600;
    color: #334155;
}
.fc-prechat-input {
    height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.fc-prechat-input:focus {
    border-color: #4f46e5;
}
.fc-prechat-gdpr {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
    margin-top: 4px;
}
.fc-prechat-gdpr input {
    margin-top: 2px;
}
.fc-prechat-submit {
    height: 40px;
    background: #4f46e5;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    margin-top: 6px;
}
.fc-prechat-submit:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.fc-ai-product-link {
    color: #4f46e5;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    display: inline-block;
    padding: 2px 6px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 4px;
    margin: 2px 0;
    transition: all 0.15s ease;
}
.fc-ai-product-link:hover {
    color: #4338ca;
    background: rgba(99, 102, 241, 0.16);
    text-decoration: none;
}

@media (max-width: 768px) {
    .fc-hide-mobile {
        display: none !important;
    }
}
@media (min-width: 769px) {
    .fc-hide-desktop {
        display: none !important;
    }
}
