/* ==========================================================================
   Floating action bar — Quick Enquiry, WhatsApp, social links.
   Fixed to the right edge, vertically centred. CSS only, no libraries;
   animations use transform/opacity so they stay off the main thread.
   ========================================================================== */

.wh-fab {
    --fab-size: 44px;
    --fab-gap: 8px;
    --fab-red: #bc2125;
    --fab-red-dark: #9e1b1f;
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 998;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--fab-gap);
    transform: translateY(-50%);
    pointer-events: none;
    contain: layout style;
    animation: wh-fab-in .5s cubic-bezier(.2, .8, .2, 1) .6s both;
}

.wh-fab > * {
    pointer-events: auto;
}

@keyframes wh-fab-in {
    from { opacity: 0; transform: translate(24px, -50%); }
    to { opacity: 1; transform: translate(0, -50%); }
}

/* Old single WhatsApp image is superseded by this bar */
body:has(.wh-fab) a.whatsapp_fixed {
    display: none !important;
}

/* --- Shared button look ------------------------------------------------ */
.wh-fab__btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--fab-size);
    height: var(--fab-size);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 12px 0 0 12px;
    background: #fff;
    color: #1d2433;
    box-shadow: 0 6px 18px -6px rgba(16, 24, 40, .28), 0 1px 3px rgba(16, 24, 40, .08);
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease, background-color .2s ease, color .2s ease;
}

.wh-fab__btn svg {
    width: 20px;
    height: 20px;
    flex: none;
    fill: currentColor;
}

.wh-fab__btn svg.is-stroke {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wh-fab__btn:hover,
.wh-fab__btn:focus-visible {
    transform: translateX(-6px);
    box-shadow: 0 10px 24px -8px rgba(16, 24, 40, .35), 0 2px 4px rgba(16, 24, 40, .08);
    outline: none;
}

.wh-fab__btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(188, 33, 37, .35), 0 10px 24px -8px rgba(16, 24, 40, .35);
}

/* Tooltip label that slides out to the left */
.wh-fab__btn[data-label]::after {
    content: attr(data-label);
    position: absolute;
    top: 50%;
    right: calc(100% + 10px);
    padding: 6px 10px;
    border-radius: 8px;
    background: #1d2433;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translate(6px, -50%);
    transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
    pointer-events: none;
}

.wh-fab__btn[data-label]:hover::after,
.wh-fab__btn[data-label]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
    transition: opacity .2s ease, transform .2s ease, visibility 0s;
}

/* --- Quick Enquiry (vertical tab) -------------------------------------- */
.wh-fab__enquiry {
    width: var(--fab-size);
    height: auto;
    padding: 16px 0;
    gap: 8px;
    flex-direction: column;
    background: var(--fab-red);
    color: #fff !important;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
}

.wh-fab__enquiry span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    line-height: 1;
}

.wh-fab__enquiry svg {
    width: 18px;
    height: 18px;
}

.wh-fab__enquiry:hover,
.wh-fab__enquiry:focus-visible {
    background: var(--fab-red-dark);
    color: #fff !important;
}

/* --- WhatsApp ----------------------------------------------------------- */
.wh-fab__wa {
    background: #25d366;
    color: #fff !important;
}

.wh-fab__wa svg {
    width: 24px;
    height: 24px;
}

.wh-fab__wa::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, .55);
    animation: wh-fab-pulse 2.6s ease-out 1.5s infinite;
    pointer-events: none;
}

@keyframes wh-fab-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, .5); }
    70%, 100% { box-shadow: 0 0 0 12px rgba(37, 211, 102, 0); }
}

.wh-fab__wa:hover,
.wh-fab__wa:focus-visible {
    background: #1ebe5b;
}

/* --- Social group ------------------------------------------------------- */
.wh-fab__social {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    border-radius: 12px 0 0 12px;
    background: #fff;
    box-shadow: 0 6px 18px -6px rgba(16, 24, 40, .28), 0 1px 3px rgba(16, 24, 40, .08);
}

.wh-fab__social li {
    margin: 0;
    padding: 0;
}

.wh-fab__social .wh-fab__btn {
    width: var(--fab-size);
    height: 40px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #4b5263;
}

.wh-fab__social li:first-child .wh-fab__btn { border-top-left-radius: 12px; }
.wh-fab__social li:last-child .wh-fab__btn { border-bottom-left-radius: 12px; }

.wh-fab__social .wh-fab__btn svg {
    width: 18px;
    height: 18px;
}

.wh-fab__social .wh-fab__btn:hover,
.wh-fab__social .wh-fab__btn:focus-visible {
    transform: translateX(-4px);
    background: #fff;
    box-shadow: -4px 4px 14px -6px rgba(16, 24, 40, .3);
    color: #fff;
}

.wh-fab__social .is-fb:hover, .wh-fab__social .is-fb:focus-visible { background: #1877f2; }
.wh-fab__social .is-ig:hover, .wh-fab__social .is-ig:focus-visible { background: linear-gradient(45deg, #f58529, #dd2a7b 50%, #8134af); }
.wh-fab__social .is-in:hover, .wh-fab__social .is-in:focus-visible { background: #0a66c2; }
.wh-fab__social .is-x:hover, .wh-fab__social .is-x:focus-visible { background: #111; }
.wh-fab__social .is-yt:hover, .wh-fab__social .is-yt:focus-visible { background: #ff0000; }

/* Mobile toggle for the social group (CSS-only) */
.wh-fab__toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.wh-fab__toggle {
    display: none;
}

/* --- Small screens ------------------------------------------------------ */
@media (max-width: 767px) {
    .wh-fab {
        --fab-size: 40px;
        --fab-gap: 6px;
        top: 55%;
    }

    .wh-fab__btn[data-label]::after {
        display: none;
    }

    .wh-fab__enquiry {
        padding: 12px 0;
        font-size: 12px;
    }

    .wh-fab__toggle {
        display: flex;
        color: #4b5263;
    }

    .wh-fab__toggle svg {
        transition: transform .25s ease;
    }

    .wh-fab__social {
        position: absolute;
        right: 0;
        bottom: calc(100% + var(--fab-gap));
        opacity: 0;
        visibility: hidden;
        transform: translateX(16px);
        transition: opacity .2s ease, transform .25s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .25s;
    }

    .wh-fab__toggle-input:checked ~ .wh-fab__social {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
        transition: opacity .2s ease, transform .25s cubic-bezier(.2, .8, .2, 1), visibility 0s;
    }

    .wh-fab__toggle-input:checked ~ .wh-fab__toggle svg {
        transform: rotate(45deg);
    }

    .wh-fab__toggle-input:focus-visible ~ .wh-fab__toggle {
        box-shadow: 0 0 0 3px rgba(188, 33, 37, .35);
    }

    /* Hover lift is not useful on touch */
    .wh-fab__btn:hover {
        transform: none;
    }
}

@media print {
    .wh-fab { display: none !important; }
}

/* ==========================================================================
   Mobile bottom action bar — Call / WhatsApp / Email / Enquiry
   Hidden on screens ≥ 768px.
   ========================================================================== */
.wh-mbar {
    display: none;
}

@media (max-width: 767px) {
    .wh-mbar {
        --mbar-h: 64px;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        height: calc(var(--mbar-h) + env(safe-area-inset-bottom));
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(17, 24, 39, .08);
        background: rgba(255, 255, 255, .96);
        -webkit-backdrop-filter: saturate(1.4) blur(10px);
        backdrop-filter: saturate(1.4) blur(10px);
        box-shadow: 0 -10px 30px -18px rgba(17, 24, 39, .35);
        contain: layout style;
        animation: wh-mbar-in .45s cubic-bezier(.2, .8, .2, 1) .3s both;
    }

    @keyframes wh-mbar-in {
        from { transform: translateY(100%); }
        to { transform: none; }
    }

    /* Reserve room so the bar never covers the end of the page */
    body:has(.wh-mbar) {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }

    .wh-mbar__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 0;
        height: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: #374151 !important;
        font-family: inherit;
        font-size: 11px;
        font-weight: 600;
        line-height: 1;
        letter-spacing: .01em;
        text-decoration: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        transition: background-color .2s ease, color .2s ease, transform .15s ease;
    }

    .wh-mbar__item svg {
        width: 22px;
        height: 22px;
        flex: none;
        fill: currentColor;
        transition: transform .2s cubic-bezier(.2, .8, .2, 1);
    }

    .wh-mbar__item svg.is-stroke {
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .wh-mbar__item:active {
        transform: scale(.94);
        background: #f3f4f6;
    }

    .wh-mbar__item:active svg {
        transform: translateY(-1px);
    }

    .wh-mbar__item:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(188, 33, 37, .3);
    }

    .wh-mbar__item.is-call svg { color: #bc2125; }
    .wh-mbar__item.is-wa svg { color: #25d366; }
    .wh-mbar__item.is-mail svg { color: #2563eb; }

    .wh-mbar__item.is-enquiry {
        background: linear-gradient(135deg, #d0262b 0%, #bc2125 55%, #9a1a1d 100%);
        color: #fff !important;
        box-shadow: 0 8px 18px -10px rgba(188, 33, 37, .8);
    }

    .wh-mbar__item.is-enquiry:active {
        background: #9a1a1d;
    }

    /* The bar replaces the older footer strip and the duplicate side buttons */
    body:has(.wh-mbar) .mobile-connect,
    body:has(.wh-mbar) .wh-fab__enquiry,
    body:has(.wh-mbar) .wh-fab__wa {
        display: none !important;
    }

    body:has(.wh-mbar) .go-top,
    body:has(.wh-mbar) .go-top.active {
        top: auto !important;
        bottom: calc(76px + env(safe-area-inset-bottom)) !important;
    }

    /* Compact enquiry popup on phones: show only the form */
    #myModal .info-panel {
        display: none !important;
    }

    #myModal .modal-dialog {
        align-items: flex-end;
        min-height: calc(100% - 20px);
    }

    #myModal .form-header {
        padding-right: 36px;
        margin-bottom: 16px;
    }

    #myModal .form-subtitle {
        font-size: .82rem;
    }

    #myModal textarea.form-control {
        min-height: 88px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wh-fab,
    .wh-fab__wa::before,
    .wh-mbar {
        animation: none;
    }

    .wh-fab__btn,
    .wh-fab__btn::after,
    .wh-fab__social,
    .wh-mbar__item,
    .wh-mbar__item svg {
        transition: none;
    }
}
