/* ── EP Comercial Widget ─────────────────────────────────────── */

#epc-widget {
    position: fixed;
    bottom: 160px; /* encima del botón Dionisio */
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Burbuja flotante ──────────────────────────────────────────── */
#epc-bubble {
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #4a6741, #3a5232);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(74,103,65,.45);
    transition: transform .2s, box-shadow .2s;
    position: relative;
    margin-left: auto;
}

#epc-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(74,103,65,.55);
}

#epc-bubble svg {
    width: 26px;
    height: 26px;
    color: #fff;
}

#epc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

@keyframes epc-pulse-anim {
    0%   { box-shadow: 0 0 0 0 rgba(74,103,65,.6); }
    70%  { box-shadow: 0 0 0 14px rgba(74,103,65,0); }
    100% { box-shadow: 0 0 0 0 rgba(74,103,65,0); }
}
#epc-bubble.epc-pulse {
    animation: epc-pulse-anim 1.2s ease-out 2;
}

/* ── Caja de chat ──────────────────────────────────────────────── */
#epc-box {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 340px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(.97);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}

#epc-box.epc-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ────────────────────────────────────────────────────── */
#epc-header {
    background: linear-gradient(135deg, #4a6741, #3a5232);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

#epc-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

#epc-hname {
    font-weight: 600;
    font-size: .95rem;
}

#epc-hstatus {
    font-size: .78rem;
    opacity: .85;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.epc-dot {
    width: 8px;
    height: 8px;
    background: #a8c5a0;
    border-radius: 50%;
    display: inline-block;
    animation: epc-blink 2s ease-in-out infinite;
}

@keyframes epc-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}

#epc-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: .75;
    line-height: 1;
    padding: 0 2px;
    transition: opacity .15s;
    flex-shrink: 0;
}
#epc-close:hover { opacity: 1; }

/* ── Mensajes ──────────────────────────────────────────────────── */
#epc-messages {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
    max-height: 340px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.epc-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
}

.epc-msg-user {
    align-self: flex-end;
    align-items: flex-end;
}

.epc-msg-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.epc-bubble-msg {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: .88rem;
    line-height: 1.5;
    word-break: break-word;
}

.epc-msg-user .epc-bubble-msg {
    background: #4a6741;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.epc-msg-assistant .epc-bubble-msg {
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

/* ── CTA button ────────────────────────────────────────────────── */
.epc-cta-wrap {
    margin-top: 8px;
}

.epc-cta-btn {
    display: inline-block;
    background: linear-gradient(135deg, #4a6741, #3a5232);
    color: #fff !important;
    text-decoration: none !important;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: .85rem;
    font-weight: 700;
    box-shadow: 0 3px 12px rgba(74,103,65,.4);
    transition: transform .15s, box-shadow .15s;
    white-space: nowrap;
}

.epc-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(74,103,65,.5);
    color: #fff !important;
}

/* ── Typing indicator ──────────────────────────────────────────── */
#epc-typing {
    padding: 4px 16px 8px;
    display: flex;
    gap: 4px;
    align-items: center;
}

#epc-typing span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: epc-typing-dot .9s ease-in-out infinite;
}

#epc-typing span:nth-child(2) { animation-delay: .15s; }
#epc-typing span:nth-child(3) { animation-delay: .30s; }

@keyframes epc-typing-dot {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Footer / input ────────────────────────────────────────────── */
#epc-footer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

#epc-input {
    flex: 1;
    resize: none;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: .88rem;
    font-family: inherit;
    outline: none;
    line-height: 1.4;
    max-height: 100px;
    overflow-y: auto;
    transition: border-color .2s;
}

#epc-input:focus {
    border-color: #4a6741;
}

#epc-send {
    width: 38px;
    height: 38px;
    background: #4a6741;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .15s;
}

#epc-send:hover  { background: #3a5232; transform: scale(1.05); }
#epc-send:disabled { background: #94a3b8; cursor: not-allowed; transform: none; }

#epc-send svg {
    width: 18px;
    height: 18px;
    color: #fff;
    fill: #fff;
}

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 420px) {
    #epc-widget {
        bottom: 150px; /* encima de Dionisio + barra nav inferior */
        right: 16px;
    }
    #epc-box {
        width: calc(100vw - 32px);
        right: 0;
        bottom: 68px;
    }
}
