/**
 * @session  2026-10-09  ef153541-27a1-471d-b1c2-f94898bcce93
 * @purpose  Wyglad wlasnego CMP (banner, przycisk ustawien, fasada YouTube, deklaracja) - pilot www.muscle-zone.ch, plik niezalezny od muscle-zone.css
 * @version  1.2
 * @change   CR r3: [hidden] bez nestingu, przycisk ustawien pod panelami bocznymi, zawijanie tabel deklaracji na telefonie
 */

mz-consent {
    position: fixed;
    z-index: 2147483000;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    max-height: 85vh;
    overflow-y: auto;
    background: #fff;
    color: #060606;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .18);
    font-size: 14px;
    line-height: 1.5;

    &[hidden] {
        display: none;
    }

    & consent-box {
        display: flex;
        gap: 24px;
        align-items: center;
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
    }

    & consent-text {
        display: block;
        flex: 1;
    }

    & h2 {
        margin: 0 0 6px;
        font-size: 17px;
        font-weight: 700;
    }

    & p {
        margin: 0;
    }

    & a {
        text-decoration: underline;
    }

    & consent-settings {
        display: none;
        margin-top: 12px;

        & label {
            display: block;
            margin-top: 10px;
            font-weight: 700;
        }

        & input {
            width: 18px;
            height: 18px;
            margin: 0 8px 0 0;
            vertical-align: -3px;
            appearance: auto;
            accent-color: #060606;
        }

        & p {
            margin-left: 26px;
            color: #444;
        }
    }

    & consent-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
        flex: 0 0 230px;

        & button {
            padding: 11px 16px;
            border: 2px solid #060606;
            border-radius: 4px;
            background: #060606;
            color: #fff;
            font-weight: 700;
            cursor: pointer;

            &:hover {
                background: #333;
                border-color: #333;
            }
        }
    }

    & button:focus-visible, & input:focus-visible, & a:focus-visible {
        outline: 3px solid #92D500;
        outline-offset: 2px;
    }

    & [data-act="save"] {
        display: none;
    }

    &[data-view="settings"] {
        & consent-settings, & [data-act="save"] {
            display: block;
        }

        & [data-act="settings"] {
            display: none;
        }
    }

    /* telefon: pasek, nie okno na pol ekranu - mniejsze odstepy i fonty, 3 rowne przyciski w jednym rzedzie */
    @media (max-width: 760px) {
        font-size: 13px;
        line-height: 1.4;

        & consent-box {
            flex-direction: column;
            align-items: stretch;
            gap: 10px;
            padding: 12px;
        }

        & h2 {
            margin-bottom: 4px;
            font-size: 15px;
        }

        & consent-actions {
            flex: none;
            flex-direction: row;
            gap: 6px;

            & button {
                flex: 1 1 0;
                min-width: 0;
                padding: 9px 4px;
                font-size: 13px;
            }
        }
    }
}

/* ukrycie bez nestingu: mz-consent/toggle maja display: block, ktore bez tej reguly bije [hidden] przegladarki */
mz-consent[hidden], mz-consent-toggle[hidden] {
    display: none;
}

mz-consent-toggle {
    position: fixed;
    z-index: 998;   /* pod panelami bocznymi (side-panel 999), ktore otwiera menu */
    left: 16px;
    bottom: 16px;
    display: block;

    &[hidden] {
        display: none;
    }

    & button {
        display: block;
        width: 44px;
        height: 44px;
        padding: 10px;
        border: 0;
        border-radius: 50%;
        background: #060606;
        color: #fff;
        cursor: pointer;
        box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
    }

    & svg {
        display: block;
        width: 24px;
        height: 24px;
    }
}

/* ten sam prog co przyklejony pasek "do koszyka" na karcie produktu (muscle-zone.css, position: fixed do 767px) */
@media (max-width: 767px) {
    body[data-route="product-product"] mz-consent-toggle {
        bottom: 76px;
    }
}

iframe[data-mz-src] {
    display: none !important;
}

mz-video-consent {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
    max-width: 640px;
    aspect-ratio: 16 / 9;
    padding: 20px;
    background: #111;
    color: #fff;
    text-align: center;
    font-size: 14px;

    & span {
        display: block;
        max-width: 460px;
    }

    & button {
        padding: 10px 18px;
        border: 2px solid #fff;
        border-radius: 4px;
        background: transparent;
        color: #fff;
        font-weight: 700;
        cursor: pointer;
    }
}

mz-cookie-declaration {
    display: block;
    margin: 20px 0;

    & table {
        width: 100%;
        margin: 8px 0 20px;
        font-size: 13px;
    }

    & th, & td {
        padding: 6px 8px;
        border: 1px solid #ddd;
        text-align: left;
        vertical-align: top;
        overflow-wrap: anywhere;   /* dlugie nazwy ciasteczek nie rozpychaja tabeli poza ekran telefonu */
    }

    & button {
        padding: 8px 14px;
        border: 2px solid #060606;
        border-radius: 4px;
        background: #060606;
        color: #fff;
        font-weight: 700;
        cursor: pointer;
    }
}
