/* =========================================================
   Sdileny kontejner plovoucich prvku praveho dolniho rohu
   (#8872). Flex sloupec kotveny vpravo dole; resi rozestupy,
   poradi, z-index a kolize s okolnimi plovoucimi prvky na
   jednom miste.

   Prvky ve stacku (odshora dolu):
   1. sipka nahoru (.arrow-up__wrapper, komponenta Lego:ArrowUp)
   2. externi Botpress chatbot (.bpFabWrapper, injektovany z CDN
      mimo kontejner - v kontejneru ma rezervovany slot a CSS ho
      na nej prispendluje)
   3. prekladac (.gcm-translator, bundle AITranslation)

   Tento soubor se linkuje z komponenty FloatingCorner, tj.
   nacita se na KAZDEM webu s kontejnerem (lego3/lego2), nezavisle
   na tom, zda jsou AITranslations zaple. Proto sem patri i
   kolizni pretizeni okolnich plovoucich prvku (drive byla
   v aitranslator_guest.css a fungovala jen se zaplymi preklady).

   Pozicovani widgetu v bundle CSS / skin SCSS se needituje -
   vsechna pravidla zde prebiji puvodni hodnoty specificitou.
   ========================================================= */

.gcm-floating-corner {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}

.gcm-floating-corner > * {
    pointer-events: auto;
}

@media (max-width: 767px) {
    .gcm-floating-corner {
        right: 16px;
        bottom: 16px;
    }
}

/* Poradi prvku (odshora dolu) - JEDINE misto zmeny poradi */
.gcm-floating-corner .arrow-up__wrapper {
    order: 1;
}

.gcm-floating-corner .gcm-floating-corner__chatbot-slot {
    order: 2;
}

.gcm-floating-corner .gcm-translator {
    order: 3;
}

/* =========================================================
   Sipka nahoru - staticky flex item; stav .top (nahore
   stranky) skryva pres opacity/visibility, slot ve stacku
   drzi, takze ostatni prvky se pri zobrazeni/skryti nehybou.
   Skinove right/bottom (fixed pozice) jsou u static no-op.
   ========================================================= */
.gcm-floating-corner .arrow-up__wrapper {
    position: static;
    opacity: 1;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.gcm-floating-corner .arrow-up__wrapper.top {
    opacity: 0;
}

/* =========================================================
   Prekladac - relativni flex item. Reset right/bottom je
   nutny: bundle nastavuje right/bottom pro fixed a u relative
   by fungovaly jako offset.
   ========================================================= */
.gcm-floating-corner .gcm-translator {
    position: relative;
    right: auto;
    bottom: auto;
}

/* Menu absolutne nad togglem - v toku by rostlo a posouvalo
   cely stack. width: max-content je nutny: absolute
   shrink-to-fit by menu sevrel na sirku uzkeho containing
   blocku (sirka togglu). */
.gcm-floating-corner .gcm-translator .gcm-translator__menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.5rem);
    width: max-content;
    max-width: calc(100vw - 3rem);
    max-height: calc(100vh - 12rem);
    margin: 0;
    overflow-y: auto;
}

/* =========================================================
   Botpress FAB - nelze vyrenderovat do kontejneru (injektuje
   se z CDN do body), proto ma v kontejneru rezervovany slot
   a fixed FAB se na nej prispendluje souradnicemi.
   body:has() zaroven zvysuje specificitu nad vlastni CSS
   Botpressu (injektovane z CDN).
   ========================================================= */
.gcm-floating-corner__chatbot-slot {
    /* vysku/sirku slotu synchronizuje JS komponenty s realnym FABem
       (--gcm-fc-fab-*); fallback 64px pro pripad bez JS */
    width: var(--gcm-fc-fab-w, 64px);
    height: var(--gcm-fc-fab-h, 64px);

    /* slot je jen distancnik - klik musi projit na fixed FAB pod nim
       (prebiji pointer-events: auto zdedene z `.gcm-floating-corner > *`) */
    pointer-events: none;
}

body:not(:has(.bpFabWrapper)) .gcm-floating-corner__chatbot-slot {
    display: none;
}

body:has(.gcm-floating-corner) .bpFabWrapper {
    right: 24px !important;
    bottom: 24px !important;
    z-index: 9999 !important;
}

/* nad translatorem (toggle 4rem + gap) */
body:has(.gcm-floating-corner .gcm-translator) .bpFabWrapper {
    bottom: calc(24px + 4rem + 12px) !important;
}

@media (max-width: 767px) {
    body:has(.gcm-floating-corner) .bpFabWrapper {
        right: 16px !important;
        bottom: 16px !important;
    }

    body:has(.gcm-floating-corner .gcm-translator) .bpFabWrapper {
        bottom: calc(16px + 4rem + 12px) !important;
    }
}

/* =========================================================
   Prechodova anti-kolize: legacy fixed sipka MIMO kontejner
   (jeste nemigrovane lego3 weby, per-site sipky lego2/legacy).
   Presunuto z aitranslator_guest.css - ted plati i s vypnutymi
   preklady. Sipku zvednout nad obsah kontejneru:
   - translator NEBO Botpress FAB pritomen -> nad nej (7rem)
   - oboje pritomno -> nad cely stack (12rem)
   ========================================================= */
body:has(.gcm-floating-corner .gcm-translator) :is(.arrow-up__wrapper, #arrow-up-holder, .arrow-up-holder, .arrow-up, #up, .stoupatko,
#totop, .totop, .gotop, .go-top, .goup, .scroll-to-top, #go-to-top,
.gcm-arrow-up, .gcm-gotop, .gcm-go-up, .gcm-up):not(.gcm-floating-corner *),
body:has(.bpFabWrapper) :is(.arrow-up__wrapper, #arrow-up-holder, .arrow-up-holder, .arrow-up, #up, .stoupatko,
#totop, .totop, .gotop, .go-top, .goup, .scroll-to-top, #go-to-top,
.gcm-arrow-up, .gcm-gotop, .gcm-go-up, .gcm-up):not(.gcm-floating-corner *) {
    right: 24px !important;
    bottom: 7rem !important;
    z-index: 1000 !important;
}

body:has(.gcm-floating-corner .gcm-translator):has(.bpFabWrapper) :is(.arrow-up__wrapper, #arrow-up-holder, .arrow-up-holder, .arrow-up, #up, .stoupatko,
#totop, .totop, .gotop, .go-top, .goup, .scroll-to-top, #go-to-top,
.gcm-arrow-up, .gcm-gotop, .gcm-go-up, .gcm-up):not(.gcm-floating-corner *) {
    bottom: 12rem !important;
}

@media (max-width: 767px) {
    body:has(.gcm-floating-corner .gcm-translator) :is(.arrow-up__wrapper, #arrow-up-holder, .arrow-up-holder, .arrow-up, #up, .stoupatko,
#totop, .totop, .gotop, .go-top, .goup, .scroll-to-top, #go-to-top,
.gcm-arrow-up, .gcm-gotop, .gcm-go-up, .gcm-up):not(.gcm-floating-corner *),
    body:has(.bpFabWrapper) :is(.arrow-up__wrapper, #arrow-up-holder, .arrow-up-holder, .arrow-up, #up, .stoupatko,
#totop, .totop, .gotop, .go-top, .goup, .scroll-to-top, #go-to-top,
.gcm-arrow-up, .gcm-gotop, .gcm-go-up, .gcm-up):not(.gcm-floating-corner *) {
        right: 16px !important;
    }
}

/* =========================================================
   Otevrene menu prekladace roste nahoru pres region sipky -
   sipku (v kontejneru i legacy mimo nej) po dobu otevreneho
   menu skryjeme. aria-expanded prepina JS prekladace.
   Presunuto z aitranslator_guest.css.
   ========================================================= */
body:has(.gcm-translator__toggle[aria-expanded="true"]) :is(.arrow-up__wrapper, #arrow-up-holder, .arrow-up-holder, .arrow-up, #up, .stoupatko,
#totop, .totop, .gotop, .go-top, .goup, .scroll-to-top, #go-to-top,
.gcm-arrow-up, .gcm-gotop, .gcm-go-up, .gcm-up) {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

/* =========================================================
   Legacy vlastni chatbot popup bublina (.chatbot-popup) -
   presunuto z aitranslator_guest.css. Mimo scope #8872, jen
   nekolidovat se stackem.
   ========================================================= */
.chatbot-popup.show {
    bottom: calc(100px + 5.5rem) !important;
}

/* =========================================================
   Nativni GCM chatbot (mimo scope #8872, jen nekolidovat):
   jeho fixed toggle sedi na 24/24, kontejner se posune nad nej.
   ========================================================= */
body:has(.gcm-chatbot) .gcm-floating-corner {
    bottom: 96px; /* toggle 24 + 60 + gap 12 */
}

/* =========================================================
   Stacking okolnich prvku nad plovoucim rohem (z-index 10000).
   Presunuto z aitranslator_guest.css.
   ========================================================= */
#cookie_consent {
    z-index: 100100;
}

#vobraze {
    z-index: 100010 !important;
}

.bpOpen {
    z-index: 10000 !important;
}

@media print {
    .gcm-floating-corner {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gcm-floating-corner .arrow-up__wrapper {
        transition: none;
    }
}
