/**
 * Zavora 360 — frontend button styles.
 *
 * Loaded only on pages where the button actually renders (enqueue is
 * gated server-side by Z360_Widget::should_render_floating + the shortcode
 * handler).
 *
 * Background color is NOT in this file — it's set inline via the button's
 * style="" attribute so per-site customisation works without a custom
 * stylesheet. Everything else (size, position, hover, focus, type) lives
 * here.
 *
 * Class naming: z360- prefix on everything. The button has both a position
 * class (z360-btn-bottom-right, etc) and a size class (z360-btn-small, etc)
 * stacked. Inline / shortcode placement uses z360-btn--inline INSTEAD of a
 * position class (BEM-flavoured modifier so it's visually distinct).
 */

/* ─── Base button ─────────────────────────────────────────────────────── */
/* Shared by both floating and inline placements. */

.z360-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-decoration: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 600;
    line-height: 1.2;
    border: none;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-align: center;
    white-space: nowrap;
    /* Reset link defaults that some themes apply globally. */
    box-sizing: border-box;
}

.z360-btn:hover,
.z360-btn:focus {
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
    outline: none;
}

.z360-btn:focus-visible {
    /* Accessibility — keyboard users need a visible focus ring. */
    outline: 3px solid rgba(29, 78, 216, 0.6);
    outline-offset: 2px;
}

.z360-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

/* ─── Size variants ──────────────────────────────────────────────────── */

.z360-btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.z360-btn-medium {
    padding: 12px 22px;
    font-size: 15px;
}

.z360-btn-large {
    padding: 16px 28px;
    font-size: 17px;
}

/* ─── Floating positions ─────────────────────────────────────────────── */
/* position: fixed pins to the viewport; z-index high enough to clear
   anything reasonable (cookie banners, modals from most themes/plugins). */

.z360-btn-bottom-right,
.z360-btn-bottom-left,
.z360-btn-top-right,
.z360-btn-top-left {
    position: fixed;
    z-index: 2147483640;     /* one short of INT32_MAX — leave headroom for emergency overrides */
}

.z360-btn-bottom-right {
    bottom: 24px;
    right: 24px;
}

.z360-btn-bottom-left {
    bottom: 24px;
    left: 24px;
}

.z360-btn-top-right {
    top: 24px;
    right: 24px;
}

.z360-btn-top-left {
    top: 24px;
    left: 24px;
}

/* ─── Inline (shortcode) variant ─────────────────────────────────────── */
/* No position:fixed — flows with the surrounding content. Slight vertical
   margin so it doesn't crowd adjacent paragraphs. */

.z360-btn--inline {
    position: static;
    margin: 8px 0;
    vertical-align: middle;
}

/* ─── Mobile tweaks ──────────────────────────────────────────────────── */

@media (max-width: 600px) {
    /* v1.4.0 - the corners stay at 24px on phones too, so stacked buttons line up with the chat button */
    .z360-btn-large {
        /* Cap the large variant on small screens — full-size eats the
           viewport. */
        padding: 13px 22px;
        font-size: 15px;
    }
}

/* ─── Print ──────────────────────────────────────────────────────────── */
/* No floating button in printouts — visually noisy and the link
   doesn't work on paper. Inline shortcode variant prints fine since
   the author placed it deliberately. */

@media print {
    .z360-btn-bottom-right,
    .z360-btn-bottom-left,
    .z360-btn-top-right,
    .z360-btn-top-left {
        display: none !important;
    }
}

/* ─── Reduced motion ─────────────────────────────────────────────────── */
/* Respect prefers-reduced-motion: drop the hover lift animation. */

@media (prefers-reduced-motion: reduce) {
    .z360-btn {
        transition: none;
    }
    .z360-btn:hover,
    .z360-btn:focus {
        transform: none;
    }
}

/* ─── v1.4.0: stacking, overlay window, in-page message ─────────────── */

.z360-btn {
    --z360-edge: 24px;
    min-height: 44px;
}

.z360-ov {
    position: fixed;
    inset: 0;
    z-index: 2147483645;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.z360-ov-box {
    position: relative;
    width: 100%;
    max-width: 920px;
    height: min(760px, 92vh);
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.z360-ov-box.z360-ov-narrow {
    max-width: 460px;
}

.z360-ov-box iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.z360-ov-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #ffffff;
    color: #334155;
    font: 26px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.z360-ov-close:focus-visible {
    outline: 3px solid rgba(29, 78, 216, 0.6);
    outline-offset: 2px;
}

.z360-toast {
    position: fixed;
    z-index: 2147483646;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(420px, calc(100vw - 32px));
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.z360-embed {
    margin: 16px 0;
}

@media print {
    .z360-ov,
    .z360-toast {
        display: none !important;
    }
}
