/* Botón flotante */
#arp-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 50px;
    background: #2271b1;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    z-index: 99998;
    transition: transform 0.2s, background 0.2s;
    white-space: nowrap;
}
#arp-chat-toggle:hover { background: #135e96; transform: translateY(-2px); }

/* Caja del chat */
#arp-chat-box {
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 110px);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
}
#arp-chat-box[style*="flex"] { display: flex; }

#arp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f7f9fc;
}

.arp-mensaje {
    margin-bottom: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}
.arp-mensaje.usuario { background: #2271b1; color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.arp-mensaje.agente { background: #fff; color: #333; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }
.arp-loading { text-align: center; color: #999; font-style: italic; padding: 10px; }

/* Input con botón de foto */
#arp-chat-input-area {
    display: flex;
    gap: 6px;
    padding: 10px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    align-items: center;
}
#arp-chat-photo {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
#arp-chat-photo:hover { background: #e5e7eb; }
#arp-chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    min-width: 0;
}
#arp-chat-input:focus { border-color: #2271b1; box-shadow: 0 0 0 2px rgba(34,113,177,0.15); }
#arp-chat-send {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#arp-chat-send:hover { background: #135e96; }

/* Tarjetas y botones de producto */
.arp-productos { margin-top: 10px; }
.arp-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 15px; margin-bottom: 12px; }
.arp-card h4 { margin: 0 0 8px 0; color: #1f2937; font-size: 15px; }
.arp-card .precio { color: #2271b1; font-weight: bold; font-size: 18px; margin: 5px 0; }
.arp-card .specs { font-size: 12px; color: #555; margin: 8px 0; line-height: 1.5; }
.arp-card .dosis { background: #f0f9ff; border-left: 3px solid #2271b1; padding: 10px; border-radius: 4px; margin: 10px 0; font-size: 13px; }
.arp-card .dosis .ficha { margin: 8px 0 0 0; font-size: 12px; color: #333; background: #fff8e5; padding: 8px; border-radius: 6px; border-left: 3px solid #f0b849; }
.arp-card .dosis .warning { color: #d97706; font-size: 12px; margin: 5px 0 0 0; }

.arp-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #f0f0f0; }
.arp-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 10px; border: none; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none; color: #fff; transition: all 0.2s; text-align: center; line-height: 1.2; font-family: inherit; }
.arp-btn:hover { transform: translateY(-1px); filter: brightness(1.08); color: #fff; }
.arp-btn-icon { font-size: 14px; }
.arp-btn-ver { background: #3b82f6; grid-column: span 2; }
.arp-btn-uso { background: #8b5cf6; }
.arp-btn-agregar { background: #10b981; }
.arp-btn-agregar.arp-btn-agregado { background: #059669; position: relative; }
.arp-btn-agregar.arp-btn-agregado::after { content: ''; position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; background: #fbbf24; border-radius: 50%; border: 2px solid #fff; }
.arp-btn-enviar { background: linear-gradient(135deg, #f59e0b, #dc2626); grid-column: span 2; padding: 11px; font-size: 13.5px; }

/* WhatsApp */
.arp-whatsapp-buttons { margin-top: 10px; padding: 15px; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 10px; }
.arp-whatsapp-buttons p { margin: 0 0 10px 0; font-size: 13px; color: #065f46; font-weight: 600; }
.arp-whatsapp-btn { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 8px; background: #25D366; color: #fff; text-decoration: none; border-radius: 8px; transition: all 0.2s; }
.arp-whatsapp-btn:hover { background: #1ebe5d; transform: translateX(4px); color: #fff; }
.arp-whatsapp-icon { font-size: 26px; }
.arp-whatsapp-text { flex: 1; }
.arp-whatsapp-text strong { display: block; font-size: 14px; margin-bottom: 2px; }
.arp-whatsapp-text small { color: rgba(255,255,255,0.9); font-size: 12px; }

/* Toast */
.arp-toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(100px); background: #1f2937; color: #fff; padding: 12px 22px; border-radius: 30px; font-size: 14px; font-weight: 500; box-shadow: 0 8px 20px rgba(0,0,0,0.25); z-index: 999999; opacity: 0; transition: all 0.3s ease; pointer-events: none; max-width: 90vw; white-space: nowrap; }
.arp-toast.arp-toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 480px) {
    #arp-chat-box { width: calc(100vw - 20px); right: 10px; bottom: 80px; height: calc(100vh - 100px); }
    #arp-chat-toggle { bottom: 15px; right: 15px; padding: 12px 20px; font-size: 15px; }
    .arp-acciones { grid-template-columns: 1fr; }
    .arp-btn-ver, .arp-btn-enviar { grid-column: span 1; }
}