/**
 * Footer UI – nustatymai, mobilus FAB, siteFooter.
 * Įkeliama tik per Slimi/footer.php (veikia visuose puslapiuose).
 */

footer#siteFooter {
    background: #111;
    color: white;
    z-index: 10;
}

#footerMobileFab {
    display: none;
}

.footer-mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1195;
    background: rgba(0, 0, 0, 0.42);
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.footer-mobile-backdrop:not([hidden]) {
    display: block;
}

.footer-mobile-fab {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid rgba(0, 255, 195, 0.45);
    border-radius: 50%;
    background: linear-gradient(145deg, #1a1d24, #0e1014);
    color: #fff;
    box-shadow:
        0 0 18px rgba(0, 255, 195, 0.35),
        0 8px 22px rgba(0, 0, 0, 0.55);
    cursor: pointer;
    position: fixed;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    z-index: 1220;
    transition: bottom 0.28s ease, transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.footer-mobile-fab:hover,
.footer-mobile-fab:focus-visible {
    box-shadow:
        0 0 22px rgba(0, 255, 195, 0.55),
        0 10px 26px rgba(0, 0, 0, 0.65);
    outline: none;
}

.footer-mobile-fab:active {
    transform: scale(0.96);
}

.footer-mobile-fab-icon {
    width: 26px;
    height: 26px;
    grid-area: 1 / 1;
}

.footer-mobile-fab-icon-close {
    display: none;
}

.footer-mobile-fab.is-open .footer-mobile-fab-icon-open {
    display: none;
}

.footer-mobile-fab.is-open .footer-mobile-fab-icon-close {
    display: block;
}

body.footer-mobile-open .footer-mobile-fab {
    bottom: calc(min(36vh, 240px) + max(10px, env(safe-area-inset-bottom, 0px)));
    right: auto;
    left: max(12px, env(safe-area-inset-left, 0px));
}

footer#siteFooter .wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100px;
    overflow: visible;
    width: 75%;
}

footer#siteFooter .info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    height: 100%;
    padding: 20px 0;
    color: white;
    background: none;
    text-decoration: none;
    cursor: pointer;
}

footer#siteFooter .info:hover p strong {
    text-decoration: underline;
}

footer#siteFooter .info img {
    height: 100%;
    aspect-ratio: 1/1;
    border-radius: 10px;
}

footer#siteFooter .actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

footer#siteFooter .actions a svg {
    color: white;
}

footer#siteFooter .settings {
    display: grid;
    place-items: center;
    position: relative;
    flex-shrink: 0;
    width: auto;
    height: auto;
    fill: white;
}

footer#siteFooter .settings .settings-toggle {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    cursor: pointer;
    fill: white;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

footer#siteFooter .settings .settings-toggle svg {
    width: 25px;
    height: 25px;
    cursor: pointer;
    transition: 0.3s;
    display: block;
}

footer#siteFooter .settings svg path {
    pointer-events: none;
}

footer#siteFooter .settings .settings-toggle:hover svg,
footer#siteFooter .settings .settings-toggle:focus-visible svg {
    transform: rotate(25deg);
}

footer#siteFooter .settings .items {
    position: absolute;
    bottom: 110%;
    right: 0;
    left: auto;
    border-radius: 10px;
    background: white;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

footer#siteFooter .settings[data-open] .items {
    opacity: 1;
    pointer-events: all;
    bottom: 120%;
    z-index: 1400;
}

footer#siteFooter .settings ul {
    display: flex;
    flex-direction: column;
    width: 230px;
    max-height: 300px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: hidden;
    overflow-y: auto;
    user-select: none;
    direction: ltr;
}

footer#siteFooter .settings .items ul > li {
    margin: 0;
    padding: 0;
    list-style: none;
}

footer#siteFooter .settings .items ul > li > button {
    width: 100%;
    box-sizing: border-box;
}

footer#siteFooter .settings .items::before {
    content: '';
    width: 10px;
    height: 10px;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    background: inherit;
}

footer#siteFooter .settings .items button {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    background: none;
    border: none;
    fill: #999;
    color: #999;
    margin: 0 10px;
    padding: 15px 0;
    font-size: 18px;
    cursor: pointer;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    transition: 0.3s;
    white-space: nowrap;
}

footer#siteFooter .settings .items > button:first-child,
footer#siteFooter .settings .items ul > li:first-child button {
    border-top: none;
}

footer#siteFooter .settings .items button * {
    pointer-events: none;
}

footer#siteFooter .settings .items button:hover,
footer#siteFooter .settings .items button:focus-visible {
    fill: var(--main-color);
    color: var(--main-color);
}

footer#siteFooter .settings .items button div {
    position: relative;
    width: 75%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: none;
}

footer#siteFooter .settings .items button svg {
    width: 20px;
    height: 20px;
    transition: none;
}

footer#siteFooter .settings input[type="radio"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    outline: 1px solid var(--main-color);
    outline-offset: 2px;
    border-radius: 100%;
}

footer#siteFooter .settings input[type="radio"]:checked {
    background: var(--main-color);
}

footer#siteFooter .settings input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 25px;
    background: none;
    border: none;
    outline: none;
    border-radius: 100%;
}

footer#siteFooter .settings ul:has(.sound-volume-row),
ul.sound-volume-menu {
    padding: 2px 0 4px;
}

footer#siteFooter .settings ul:has(.sound-volume-row) > button:first-child,
ul.sound-volume-menu > button:first-child {
    padding: 10px 10px 6px;
}

footer#siteFooter .settings .sound-volume-row,
ul.sound-volume-menu .sound-volume-row {
    align-items: center;
    padding: 8px 10px 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: none;
    margin: 0;
    box-sizing: border-box;
}

footer#siteFooter .settings .sound-volume-row .sound-volume-icon,
ul.sound-volume-menu .sound-volume-row .sound-volume-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #475569;
}

footer#siteFooter .settings .sound-volume-row .sound-volume-label,
ul.sound-volume-menu .sound-volume-row .sound-volume-label {
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 500;
    color: #334155;
    min-width: 0;
}

footer#siteFooter .settings .sound-volume-row .sound-volume-controls,
ul.sound-volume-menu .sound-volume-row .sound-volume-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

footer#siteFooter .settings .sound-volume-row .sound-volume-value,
ul.sound-volume-menu .sound-volume-row .sound-volume-value {
    flex-shrink: 0;
    min-width: 2.25em;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

footer#siteFooter .settings input[type="range"],
footer#siteFooter .settings .sound-volume-slider,
ul.sound-volume-menu .sound-volume-slider,
ul.sound-volume-menu input[type="range"] {
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    flex: 1;
    min-width: 80px;
    max-width: 140px;
    margin: 0;
    padding: 0;
    outline: none;
    background: transparent;
}

footer#siteFooter .settings input[type="range"]::-webkit-slider-runnable-track,
ul.sound-volume-menu input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 4px;
}

footer#siteFooter .settings input[type="range"]::-webkit-slider-thumb,
ul.sound-volume-menu input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -5px;
    border-radius: 50%;
    background: var(--main-color);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

footer#siteFooter .settings input[type="range"]::-moz-range-track,
ul.sound-volume-menu input[type="range"]::-moz-range-track {
    height: 8px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    border: none;
}

footer#siteFooter .settings input[type="range"]::-moz-range-thumb,
ul.sound-volume-menu input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--main-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

@media (width <= 900px) {
    #footerMobileFab {
        display: grid;
        width: 46px;
        height: 46px;
    }

    #footerMobileFab .footer-mobile-fab-icon {
        width: 22px;
        height: 22px;
    }

    footer#siteFooter {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: min(36vh, 240px);
        transform: translateY(100%);
        transition: transform 0.28s ease;
        z-index: 1210;
        overflow: visible;
        display: flex;
        flex-direction: column;
        box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.45);
        pointer-events: none;
        border-radius: 14px 14px 0 0;
        font-size: 13px;
    }

    body.footer-mobile-open footer#siteFooter {
        transform: translateY(0);
        pointer-events: auto;
        z-index: 1540;
    }

    footer#siteFooter .settings ul {
        width: min(230px, calc(100vw - 24px));
        max-height: min(50vh, 320px);
    }

    /* Atidarytas meniu – fixed sluoksnis, centruotas virš footer (ne kirpti .wrapper overflow) */
    body.footer-settings-open footer#siteFooter .settings[data-open] .items {
        position: fixed;
        z-index: 1560;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(280px, calc(100vw - 24px));
        border-radius: 12px;
        box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
        opacity: 1;
        pointer-events: auto;
    }

    body.footer-settings-open footer#siteFooter .settings[data-open] .items::before {
        left: 50%;
        transform: translate(-50%, -50%) rotate(45deg);
    }

    body.footer-settings-open.footer-mobile-open .footer-mobile-backdrop {
        z-index: 1535;
    }

    body.footer-settings-open #footerMobileFab {
        z-index: 1555;
    }

    footer#siteFooter .wrapper {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 0;
        flex: 1 1 auto;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        align-items: stretch;
        padding: 8px 10px;
        gap: 8px;
        font-size: 13px;
        line-height: 1.25;
    }

    footer#siteFooter .wrapper .credit {
        display: none;
    }

    footer#siteFooter #chatToggle {
        padding: 6px 10px;
        margin: 0;
        font-size: 12px;
        gap: 6px;
        border-radius: 12px;
    }

    footer#siteFooter #onlineCount {
        padding: 3px 8px;
        font-size: 11px;
    }

    footer#siteFooter #userList {
        max-width: min(100vw - 24px, 420px);
        width: auto;
        font-size: 13px;
    }

    footer#siteFooter .info {
        padding: 4px 0;
        gap: 8px;
        min-height: 0;
    }

    footer#siteFooter .info img {
        height: 36px;
        max-height: 36px;
        width: auto;
        border-radius: 8px;
    }

    footer#siteFooter .info p {
        font-size: 12px;
        line-height: 1.3;
    }

    footer#siteFooter .actions {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }

    footer#siteFooter .actions .main-btn {
        padding: 7px 12px;
        font-size: 12px;
        gap: 6px;
        border-radius: 6px;
    }

    footer#siteFooter .actions .main-btn svg {
        width: 14px;
        height: 14px;
    }

    footer#siteFooter .settings .settings-toggle {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }

    footer#siteFooter .settings .settings-toggle svg {
        width: 24px;
        height: 24px;
    }

    footer#siteFooter .settings .items button {
        font-size: 14px;
        padding: 8px 0;
        margin: 0 8px;
    }

    footer#siteFooter .settings .items button svg {
        width: 18px;
        height: 18px;
    }

    body:not(.footer-mobile-open) #chatContainer {
        bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    body.footer-mobile-open #chatContainer {
        bottom: calc(min(10vh, 240px) + 6px + env(safe-area-inset-bottom, 0px));
        pointer-events: none;
    }

    body.footer-mobile-open.chat-open #chatbox,
    body.footer-mobile-open.chat-open .chat-collapse-btn {
        pointer-events: auto;
    }
}

/* Web Push nustatymai (footer settings) */
footer#siteFooter .settings .items.push-settings-menu {
    min-width: 240px;
    max-width: 320px;
}

footer#siteFooter .settings .push-settings-hint {
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.65);
    margin: 8px 12px 4px;
    padding: 0;
}

footer#siteFooter .settings .push-enable-btn,
footer#siteFooter .settings .push-disable-btn {
    display: block;
    width: calc(100% - 16px);
    margin: 8px;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    color: #fff;
}

footer#siteFooter .settings .push-enable-btn {
    background: linear-gradient(135deg, #2e7d32, #43a047);
}

footer#siteFooter .settings .push-disable-btn {
    background: linear-gradient(135deg, #c62828, #e53935);
}

footer#siteFooter .settings .push-pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}

footer#siteFooter .settings .push-pref-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    margin: 0 12px 8px;
    line-height: 1.3;
}

footer#siteFooter .settings .push-pref-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--main-color, #4caf50);
    cursor: pointer;
}

/* OpenCase (/opencase/index.php) – footer visada matomas scroll sraute (desktop + mobile) */
body.oc-case-page footer#siteFooter {
    position: relative !important;
    transform: none !important;
    translate: none !important;
    max-height: none !important;
    pointer-events: auto !important;
    overflow: visible !important;
    box-shadow: none;
    border-radius: 0;
    bottom: auto;
    left: auto;
    right: auto;
    width: 100%;
    flex-shrink: 0;
    z-index: 1200 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.oc-case-page #footerMobileFab,
body.oc-case-page .footer-mobile-backdrop {
    display: none !important;
}

body.oc-case-page .wrapper.oc-case-page__wrapper {
    height: auto;
    min-height: 0;
    overflow: visible;
    flex: 1 0 auto;
    display: block;
    width: 100%;
}

/* OpenCase (/opencase/index.php) – mobile papildomi footer nustatymai */
@media (width <= 900px) {
    body.oc-case-page footer#siteFooter {
        position: relative;
        transform: none;
        translate: none;
        max-height: none;
        pointer-events: auto;
        overflow: visible;
        box-shadow: none;
        border-radius: 0;
        bottom: auto;
        left: auto;
        right: auto;
        width: 100%;
        z-index: 1200 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    body.oc-case-page #footerMobileFab,
    body.oc-case-page .footer-mobile-backdrop {
        display: none !important;
    }
}
