/* ============================================
   MASSGO - Chatbot Widget Flotante
   ============================================ */

/* ── Botón flotante ── */
.chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--rosa-fuerte, #FF0066);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(255, 0, 102, 0.35);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(255, 0, 102, 0.45);
}

.chatbot-fab .fab-icon-open,
.chatbot-fab .fab-icon-close {
    transition: opacity 0.2s, transform 0.3s;
}

.chatbot-fab .fab-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}

.chatbot-fab.active .fab-icon-open {
    opacity: 0;
    transform: rotate(90deg);
}

.chatbot-fab.active .fab-icon-close {
    opacity: 1;
    transform: rotate(0);
}

/* ── Panel del chat ── */
.chatbot-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 440px;
    max-width: calc(100vw - 48px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
}

.chatbot-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Header del panel ── */
.chatbot-header {
    background: var(--rosa-fuerte, #FF0066);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chatbot-header-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.chatbot-header-info {
    flex: 1;
    min-width: 0;
}

.chatbot-header-info h6 {
    margin: 0;
    font-size: .9rem;
    font-weight: 700;
}

.chatbot-header-info small {
    font-size: .7rem;
    opacity: 0.85;
}

/* ── Mensajes ── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fb;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: .82rem;
    line-height: 1.5;
    animation: msgIn 0.25s ease-out;
}

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

.msg-bot {
    align-self: flex-start;
    background: white;
    border: 1px solid #eee;
    border-bottom-left-radius: 4px;
    color: #1a1a2e;
}

.msg-user {
    align-self: flex-end;
    background: var(--rosa-fuerte, #FF0066);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-bot strong {
    color: var(--rosa-fuerte, #FF0066);
}

/* ── Indicador de escritura ── */
.typing-indicator {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #eee;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%,
    60%,
    100% {
        transform: translateY(0);
        background: #ccc;
    }
    30% {
        transform: translateY(-6px);
        background: var(--rosa-fuerte, #FF0066);
    }
}

/* ── Acciones rápidas ── */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px 4px;
    background: #f8f9fb;
    flex-shrink: 0;
}

.quick-reply-btn {
    font-size: .72rem;
    padding: 6px 14px;
    border-radius: 50px;
    border: 1.5px solid var(--rosa-fuerte, #FF0066);
    background: transparent;
    color: var(--rosa-fuerte, #FF0066);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: var(--rosa-fuerte, #FF0066);
    color: white;
}

/* ── Input ── */
.chatbot-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: white;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px 4px;
    font-size: .85rem;
    font-family: inherit;
}

.chatbot-input::placeholder {
    color: #b0b8c4;
}

.chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--rosa-fuerte, #FF0066);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .9rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    background: #e00058;
}

.chatbot-send:disabled {
    background: #ddd;
    cursor: not-allowed;
}

/* ── WhatsApp mini CTA ── */
.chatbot-whatsapp-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #e8f5e9;
    border-top: 1px solid #c8e6c9;
    flex-shrink: 0;
    font-size: .78rem;
    color: #2e7d32;
}

.chatbot-whatsapp-bar a {
    color: #1b5e20;
    font-weight: 700;
    text-decoration: none;
}

.chatbot-whatsapp-bar a:hover {
    text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 576px) {
    .chatbot-fab {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    .chatbot-panel {
        bottom: 76px;
        right: 12px;
        width: calc(100vw - 24px);
        height: calc(100vh - 100px);
        border-radius: 16px;
    }
}
