/*
 * Bilbordia Tawk Launcher — custom avatar styles + Tawk-iframe defense-in-depth.
 *
 * Tawk's iframes are stripped from layout via display:none so right-click on
 * Tawk's launcher (cross-origin iframe, contextmenu doesn't bubble to parent)
 * is no longer a click target. WP Ghost's right-click protection covers our
 * own avatar element since it lives in our DOM.
 */

iframe[src*="tawk.to"],
iframe[title*="tawk" i],
iframe[id^="tawk-"],
iframe[class*="tawk-"] {
    display: none !important;
}

/*
 * Positioning declared with !important + repeated id+class selector to win
 * specificity battles against the active theme (Woodmart) and Elementor
 * containers, which otherwise can absorb the launcher into their layout
 * (transform on an ancestor demotes our position:fixed to position:absolute,
 * leaving the avatar buried somewhere in the page flow). The inset:auto
 * resets defend against themes that set top/left on .bilbordia-* selectors.
 */
#bilbordia-tawk-launcher.bilbordia-tawk-launcher,
.bilbordia-tawk-launcher {
    --btawk-accent: #0073aa;
    --btawk-bg: #ffffff;
    --btawk-text: #1d2327;

    position: fixed !important;
    top: auto !important;
    left: auto !important;
    right: 20px !important;
    bottom: 20px !important;
    z-index: 2147483600 !important; /* one notch below the absolute max so admin bars / modals can still cover */
    margin: 0 !important;
    transform: none !important;       /* don't let the theme transform us into a containing block */
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;

    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 8px;
    background: var(--btawk-bg);
    color: var(--btawk-text);
    border: 2px solid var(--btawk-accent);
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: box-shadow 150ms ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.2;
    text-decoration: none;
    box-sizing: border-box;
}

.bilbordia-tawk-launcher:hover,
.bilbordia-tawk-launcher:focus-visible {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    outline: none;
}

.bilbordia-tawk-launcher:focus-visible {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22), 0 0 0 3px rgba(0, 115, 170, 0.45);
}

.bilbordia-tawk-launcher__avatar-wrap {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
}

.bilbordia-tawk-launcher__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f0f1;
    display: block;
}

.bilbordia-tawk-launcher__status-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #9ca3af; /* unknown */
    border: 2px solid var(--btawk-bg);
    box-sizing: content-box;
}

.bilbordia-tawk-launcher[data-status="online"] .bilbordia-tawk-launcher__status-dot {
    background: #22c55e;
}
.bilbordia-tawk-launcher[data-status="away"] .bilbordia-tawk-launcher__status-dot {
    background: #f59e0b;
}
.bilbordia-tawk-launcher[data-status="offline"] .bilbordia-tawk-launcher__status-dot {
    background: #9ca3af;
}

.bilbordia-tawk-launcher__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border: 2px solid var(--btawk-bg);
    box-sizing: content-box;
}

.bilbordia-tawk-launcher__label {
    font-weight: 600;
    color: var(--btawk-text);
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    .bilbordia-tawk-launcher {
        padding: 6px;
        gap: 0;
    }
    .bilbordia-tawk-launcher__label {
        display: none;
    }
}
