/* ML WhatsApp Pro — Widget Frontend v1.0 */

:root {
    --mlwa-color: #25D366;
    --mlwa-size:  60px;
    --mlwa-radius: 14px;
    --mlwa-shadow: 0 4px 20px rgba(0,0,0,.25);
    --mlwa-z: 9999;
}

/* ── Wrap ────────────────────────────────────────────────────────────── */
#mlwa-wrap {
    position: fixed;
    z-index: var(--mlwa-z);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}
#mlwa-wrap[hidden] { display: none !important; }

.mlwa-pos-bottom-right { bottom: 24px; right: 24px; align-items: flex-end; }
.mlwa-pos-bottom-left  { bottom: 24px; left:  24px; align-items: flex-start; }

/* ── Botón principal ─────────────────────────────────────────────────── */
.mlwa-btn {
    width:  var(--mlwa-size);
    height: var(--mlwa-size);
    border-radius: 50%;
    background: var(--mlwa-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--mlwa-shadow);
    transition: transform .2s ease, box-shadow .2s ease;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    text-decoration: none;
}
.mlwa-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,0,0,.3);
}
.mlwa-btn svg {
    width:  calc(var(--mlwa-size) * .5);
    height: calc(var(--mlwa-size) * .5);
    flex-shrink: 0;
}
.mlwa-icon-close { display: none; }
.mlwa-btn.is-open .mlwa-icon-open  { display: none; }
.mlwa-btn.is-open .mlwa-icon-close { display: block; }

/* ── Pulse ────────────────────────────────────────────────────────────── */
.mlwa-pulse {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width:  var(--mlwa-size);
    height: var(--mlwa-size);
    border-radius: 50%;
    background: var(--mlwa-color);
    opacity: .4;
    animation: mlwa-pulse 2s ease-out infinite;
    z-index: 1;
    pointer-events: none;
}
.mlwa-pos-bottom-left .mlwa-pulse { right: auto; left: 24px; }

@keyframes mlwa-pulse {
    0%   { transform: scale(1);   opacity: .4; }
    70%  { transform: scale(1.6); opacity: 0;  }
    100% { transform: scale(1.6); opacity: 0;  }
}

/* ── Tooltip ─────────────────────────────────────────────────────────── */
.mlwa-tooltip {
    background: #fff;
    color: #333;
    padding: 10px 36px 10px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-shadow: var(--mlwa-shadow);
    white-space: nowrap;
    position: relative;
    animation: mlwa-slide-in .3s ease;
    max-width: 220px;
    white-space: normal;
}
.mlwa-tooltip-close {
    position: absolute;
    top: 6px; right: 8px;
    background: none; border: none;
    font-size: 16px; line-height: 1;
    cursor: pointer; color: #999;
    padding: 0 2px;
}
.mlwa-tooltip-close:hover { color: #333; }

/* ── Panel multi-agente ──────────────────────────────────────────────── */
.mlwa-panel {
    background: #fff;
    border-radius: var(--mlwa-radius);
    box-shadow: var(--mlwa-shadow);
    width: 310px;
    overflow: hidden;
    animation: mlwa-slide-in .25s ease;
}
.mlwa-panel[hidden] { display: none !important; }

.mlwa-panel-header {
    background: var(--mlwa-color);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.mlwa-panel-wa-logo {
    width: 36px; height: 36px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.mlwa-panel-wa-logo svg { width: 20px; height: 20px; }
.mlwa-panel-text { flex: 1; color: #fff; }
.mlwa-panel-text strong { display: block; font-size: 14px; }
.mlwa-panel-text span   { font-size: 12px; opacity: .85; }
.mlwa-close-btn {
    background: none; border: none;
    cursor: pointer; padding: 4px;
    opacity: .8; flex-shrink: 0;
}
.mlwa-close-btn:hover { opacity: 1; }
.mlwa-close-btn svg { width: 18px; height: 18px; display: block; }

.mlwa-panel-body { padding: 8px 0; }

/* ── Agente card ─────────────────────────────────────────────────────── */
.mlwa-agent {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    transition: background .15s;
    border-bottom: 1px solid #f0f0f0;
}
.mlwa-agent:last-child { border-bottom: none; }
.mlwa-agent:hover { background: #f9f9f9; }

.mlwa-agent-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--mlwa-color);
    color: #fff;
    font-size: 18px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.mlwa-agent-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.mlwa-status-dot {
    position: absolute;
    bottom: 2px; right: 2px;
    width: 10px; height: 10px;
    background: #4caf50;
    border-radius: 50%;
    border: 2px solid #fff;
}
.mlwa-agent-info { flex: 1; }
.mlwa-agent-info strong { display: block; font-size: 14px; color: #222; }
.mlwa-agent-info span   { font-size: 12px; color: #888; }
.mlwa-agent-arrow { color: #ccc; }
.mlwa-agent-arrow svg { width: 18px; height: 18px; }

/* ── Offline ─────────────────────────────────────────────────────────── */
.mlwa-offline {
    padding: 20px 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
}
.mlwa-offline-icon { display: block; font-size: 28px; margin-bottom: 8px; }

/* ── Animaciones ─────────────────────────────────────────────────────── */
@keyframes mlwa-slide-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .mlwa-panel { width: calc(100vw - 32px); }
    .mlwa-pos-bottom-right { right: 16px; bottom: 16px; }
    .mlwa-pos-bottom-left  { left:  16px; bottom: 16px; }
    .mlwa-pulse {
        right: 16px; bottom: 16px;
    }
    .mlwa-pos-bottom-left .mlwa-pulse { left: 16px; }
}
