/* ============================================================================
 * Mox Toolbox — Live Chat (Visitor Widget)
 * Hardened against theme & Elementor styles: high-specificity #mox-lc selectors
 * + targeted !important resets so the bubble always follows the plugin's own
 * theme_color / text_color settings regardless of the active theme.
 * ========================================================================== */

#mox-lc {
    position: fixed;
    z-index: 2147483000;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: normal;
    text-align: left;
    color: #1e293b;
    direction: ltr;
}

/* Reset inheritance so the host theme / Elementor cannot leak in. */
#mox-lc, #mox-lc *, #mox-lc *::before, #mox-lc *::after {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}
#mox-lc * {
    font-family: inherit !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-shadow: none !important;
    float: none !important;
    max-width: none;
    visibility: visible;
}
/* Neutralise theme button / input / link styling inside the widget. */
#mox-lc button,
#mox-lc input,
#mox-lc textarea,
#mox-lc a {
    margin: 0;
    font-family: inherit !important;
    font-size: inherit;
    line-height: normal;
    text-transform: none !important;
    letter-spacing: normal !important;
    box-shadow: none;
    text-decoration: none !important;
    width: auto;
}
#mox-lc button {
    -webkit-appearance: none !important;
    appearance: none !important;
    border: 0 !important;
    background: none;
    cursor: pointer;
    min-height: 0;
    outline: none;
}
#mox-lc a { background: none; }

/* ---------- Launcher ---------- */
#mox-lc .mox-lc-launcher {
    position: relative;
    width: 60px !important;
    height: 60px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: var(--mox-lc-theme, #228be6) !important;
    color: var(--mox-lc-text, #fff) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0,0,0,.18) !important;
    transition: transform .15s ease, box-shadow .15s ease;
}
#mox-lc .mox-lc-launcher:hover { transform: scale(1.06); box-shadow: 0 10px 28px rgba(0,0,0,.24) !important; }
#mox-lc .mox-lc-launcher:active { transform: scale(.96); }
#mox-lc .mox-lc-launcher svg { width: 26px; height: 26px; stroke: currentColor; fill: none; display: block; }
#mox-lc.mox-lc-left .mox-lc-launcher { float: left; }

#mox-lc .mox-lc-badge {
    position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
    background: #ef4444 !important; color: #fff !important; border-radius: 10px; font-size: 11px; font-weight: 700;
    line-height: 20px; text-align: center; box-shadow: 0 0 0 2px #fff;
}
#mox-lc .mox-lc-launcher.mox-lc-has-unread { animation: mox-lc-pulse 1.6s infinite; }
@keyframes mox-lc-pulse {
    0% { box-shadow: 0 8px 24px rgba(0,0,0,.18), 0 0 0 0 rgba(56,88,233,.5); }
    70% { box-shadow: 0 8px 24px rgba(0,0,0,.18), 0 0 0 12px rgba(56,88,233,0); }
    100% { box-shadow: 0 8px 24px rgba(0,0,0,.18), 0 0 0 0 rgba(56,88,233,0); }
}

/* ---------- Panel ---------- */
#mox-lc .mox-lc-panel {
    position: absolute; bottom: 76px; width: 360px; max-width: calc(100vw - 32px);
    height: 520px; max-height: calc(100vh - 120px);
    background: #fff !important; border-radius: 16px; overflow: hidden; display: none; flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,.22); border: 1px solid #e5e7eb;
}
#mox-lc.mox-lc-right .mox-lc-panel { right: 0; }
#mox-lc.mox-lc-left .mox-lc-panel { left: 0; }
#mox-lc .mox-lc-panel.mox-lc-open { display: flex; animation: mox-lc-in .2s ease; }
@keyframes mox-lc-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

#mox-lc .mox-lc-header {
    background: var(--mox-lc-theme, #228be6) !important; color: var(--mox-lc-text, #fff) !important;
    padding: 16px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
#mox-lc .mox-lc-title { margin: 0 !important; padding: 0 !important; font-size: 16px !important; font-weight: 700 !important; line-height: 1.2 !important; color: inherit !important; }
#mox-lc .mox-lc-subtitle { margin: 4px 0 0 !important; padding: 0 !important; font-size: 12px !important; opacity: .9; line-height: 1.4 !important; color: inherit !important; }
#mox-lc .mox-lc-close { background: transparent !important; border: 0 !important; color: inherit !important; font-size: 24px !important; line-height: 1; cursor: pointer; opacity: .85; padding: 0 !important; width: auto !important; height: auto !important; }
#mox-lc .mox-lc-close:hover { opacity: 1; }

#mox-lc .mox-lc-online { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#mox-lc .mox-lc-messages { flex: 1; overflow-y: auto; padding: 16px; background: #f8fafc !important; display: flex; flex-direction: column; gap: 10px; }
#mox-lc .mox-lc-msg { display: flex; flex-direction: column; max-width: 80%; }
#mox-lc .mox-lc-msg-visitor { align-self: flex-end; align-items: flex-end; }
#mox-lc .mox-lc-msg-agent { align-self: flex-start; align-items: flex-start; }
#mox-lc .mox-lc-msg-author { font-size: 10px; font-weight: 700; color: #64748b; margin: 0 0 3px 4px; }
#mox-lc .mox-lc-bubble { padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; word-wrap: break-word; white-space: pre-wrap; margin: 0; }
#mox-lc .mox-lc-msg-agent .mox-lc-bubble { background: #fff !important; color: #1e293b !important; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }
#mox-lc .mox-lc-msg-visitor .mox-lc-bubble { background: var(--mox-lc-theme, #228be6) !important; color: var(--mox-lc-text, #fff) !important; border-bottom-right-radius: 4px; }
#mox-lc .mox-lc-time { font-size: 10px; color: #94a3b8; margin: 3px 4px 0; }

#mox-lc .mox-lc-identity { display: flex; gap: 8px; padding: 10px 12px 0; }
#mox-lc .mox-lc-input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid #e5e7eb !important; border-radius: 8px; font-size: 13px; background: #fff !important; color: #1e293b !important; }
#mox-lc .mox-lc-input:focus { outline: none; border-color: var(--mox-lc-theme, #228be6) !important; }

#mox-lc .mox-lc-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid #eef2f7; background: #fff !important; }
#mox-lc .mox-lc-text {
    flex: 1; resize: none; border: 1px solid #e5e7eb !important; border-radius: 10px; padding: 10px 12px;
    font-size: 13.5px; line-height: 1.4; max-height: 110px; background: #fff !important; color: #1e293b !important;
}
#mox-lc .mox-lc-text:focus { outline: none; border-color: var(--mox-lc-theme, #228be6) !important; }
#mox-lc .mox-lc-send {
    flex-shrink: 0; width: 40px !important; height: 40px !important; border-radius: 10px !important; padding: 0 !important;
    background: var(--mox-lc-theme, #228be6) !important; color: var(--mox-lc-text, #fff) !important;
    display: flex !important; align-items: center; justify-content: center; transition: opacity .15s ease;
}
#mox-lc .mox-lc-send:hover { opacity: .9; }
#mox-lc .mox-lc-send svg { stroke: currentColor; fill: none; }

#mox-lc .mox-lc-footer { text-align: center; font-size: 10px; color: #cbd5e1 !important; padding: 6px 0 9px; background: #fff !important; }

/* ---------- Offline / email support ---------- */
#mox-lc .mox-lc-offline { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px 22px; gap: 12px; background: #f8fafc !important; }
#mox-lc .mox-lc-offline-icon { width: 56px; height: 56px; border-radius: 50%; background: #fef2f2 !important; color: #ef4444 !important; display: flex; align-items: center; justify-content: center; }
#mox-lc .mox-lc-offline-msg { margin: 0 !important; font-size: 13.5px !important; color: #475569 !important; line-height: 1.55 !important; font-weight: 500; }
#mox-lc .mox-lc-offline-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 11px 18px; background: var(--mox-lc-theme, #228be6) !important; color: var(--mox-lc-text, #fff) !important; border-radius: 10px; font-size: 13.5px; font-weight: 700; }
#mox-lc .mox-lc-offline-btn:hover { opacity: .92; }
#mox-lc .mox-lc-offline-email { font-size: 12px; color: #94a3b8 !important; word-break: break-all; }

/* ---------- Attention shake (agent messages first) ---------- */
@keyframes mox-lc-shake {
    0%, 100% { transform: rotate(0) scale(1); }
    10% { transform: rotate(-14deg) scale(1.08); }
    20% { transform: rotate(12deg) scale(1.08); }
    30% { transform: rotate(-10deg) scale(1.06); }
    40% { transform: rotate(10deg) scale(1.06); }
    50% { transform: rotate(-6deg) scale(1.04); }
    60% { transform: rotate(6deg) scale(1.04); }
    70% { transform: rotate(-3deg) scale(1.02); }
    80% { transform: rotate(3deg) scale(1.02); }
    90% { transform: rotate(-1deg) scale(1.01); }
}
#mox-lc .mox-lc-launcher.mox-lc-shake { animation: mox-lc-shake 0.8s ease-in-out 2; }
@media (prefers-reduced-motion: reduce) {
    #mox-lc .mox-lc-launcher.mox-lc-shake { animation: none; }
}

@media (max-width: 480px) {
    #mox-lc .mox-lc-panel { width: calc(100vw - 24px); height: calc(100vh - 110px); }
}
