/**
 * CC PrestaShop EU Cookies
 *
 * @author    COCOS <hello@cocos.codes>
 * @copyright 2026 COCOS
 * @license   Licencja komercyjna COCOS - korzystanie wyłącznie po wykupieniu płatnej licencji (zob. LICENSE.txt)
 */

/*
 * Baner zgody na pliki cookie.
 * Kolory, zaokrąglenie i szerokość przychodzą z konfiguracji modułu jako zmienne CSS (--cck-*).
 */
.cc-ps-cookies-banner {
    --cck-bg: #ffffff;
    --cck-text: #1f2328;
    --cck-primary-bg: #111827;
    --cck-primary-text: #ffffff;
    --cck-secondary: #111827;
    --cck-radius: 16px;
    --cck-max-width: 440px;
    --cck-shadow: 0 24px 60px -12px rgba(16, 24, 40, .28), 0 2px 6px rgba(16, 24, 40, .08);
    --cck-muted: color-mix(in srgb, var(--cck-text) 68%, transparent);
    --cck-line: color-mix(in srgb, var(--cck-text) 12%, transparent);
    --cck-soft: color-mix(in srgb, var(--cck-text) 5%, transparent);

    position: fixed;
    z-index: 99999;
    box-sizing: border-box;
    width: min(var(--cck-max-width), calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    overscroll-behavior: contain;
    padding: 24px;
    color: var(--cck-text);
    background: var(--cck-bg);
    border: 1px solid var(--cck-line);
    border-radius: var(--cck-radius);
    box-shadow: var(--cck-shadow);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.55;
    text-align: left;
    -webkit-font-smoothing: antialiased;
    animation: cck-in .35s cubic-bezier(.2, .8, .2, 1) both;
}

.cc-ps-cookies-banner *,
.cc-ps-cookies-banner *::before,
.cc-ps-cookies-banner *::after {
    box-sizing: border-box;
}

@keyframes cck-in {
    from { opacity: 0; translate: 0 16px; }
    to { opacity: 1; translate: 0 0; }
}

@keyframes cck-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Nagłówek i treść */
.cc-ps-cookies-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
}

.cc-ps-cookies-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--cck-primary-bg);
    background: color-mix(in srgb, var(--cck-primary-bg) 12%, transparent);
}

.cc-ps-cookies-banner h3 {
    margin: 0;
    padding: 0;
    color: inherit;
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -.01em;
    text-transform: none;
}

.cc-ps-cookies-message {
    color: var(--cck-muted);
}

.cc-ps-cookies-message p {
    margin: 0 0 6px;
    color: inherit;
    font-size: inherit;
}

.cc-ps-cookies-message p:last-child {
    margin-bottom: 0;
}

.cc-ps-cookies-message a {
    color: var(--cck-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Przyciski */
.cc-ps-cookies-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.cc-ps-cookies-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 0;
    padding: 10px 18px;
    border: 1.5px solid transparent;
    border-radius: max(8px, calc(var(--cck-radius) * .6));
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transition: background-color .2s, border-color .2s, color .2s, transform .1s, filter .2s;
}

.cc-ps-cookies-btn:active {
    transform: scale(.98);
}

.cc-ps-cookies-btn:focus-visible,
.cc-ps-cookies-group-toggle:focus-visible,
.cc-ps-cookies-close:focus-visible,
.cc-ps-cookies-switch input:focus-visible + .cc-ps-cookies-slider {
    outline: 2px solid var(--cck-primary-bg);
    outline-offset: 2px;
}

.cc-ps-cookies-btn-primary {
    color: var(--cck-primary-text);
    background: var(--cck-primary-bg);
    border-color: var(--cck-primary-bg);
}

.cc-ps-cookies-btn-primary:hover {
    color: var(--cck-primary-text);
    filter: brightness(1.12);
}

.cc-ps-cookies-btn-secondary {
    color: var(--cck-secondary);
    background: transparent;
    border-color: color-mix(in srgb, var(--cck-secondary) 35%, transparent);
}

.cc-ps-cookies-btn-secondary:hover {
    color: var(--cck-secondary);
    background: color-mix(in srgb, var(--cck-secondary) 7%, transparent);
    border-color: var(--cck-secondary);
}

/* Widok ustawień */
.cc-ps-cookies-banner [hidden] {
    display: none !important;
}

.cc-ps-cookies-prefs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.cc-ps-cookies-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    margin: -6px -6px -6px 0;
    padding: 0;
    color: var(--cck-muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.cc-ps-cookies-close:hover {
    color: var(--cck-text);
    background: var(--cck-soft);
}

.cc-ps-cookies-prefs-intro {
    margin: 0 0 16px;
    color: var(--cck-muted);
}

.cc-ps-cookies-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cc-ps-cookies-group {
    padding: 14px 16px;
    background: var(--cck-soft);
    border: 1px solid var(--cck-line);
    border-radius: max(10px, calc(var(--cck-radius) * .75));
}

.cc-ps-cookies-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cc-ps-cookies-group-name {
    font-weight: 600;
    color: var(--cck-text);
}

.cc-ps-cookies-group-required {
    flex: none;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cck-muted);
    background: var(--cck-bg);
    border: 1px solid var(--cck-line);
    border-radius: 999px;
}

.cc-ps-cookies-group-description {
    margin-top: 6px;
    font-size: 13px;
    color: var(--cck-muted);
}

.cc-ps-cookies-group-description p {
    margin: 0;
}

/* Przełącznik */
.cc-ps-cookies-switch {
    position: relative;
    flex: none;
    display: inline-block;
    width: 44px;
    height: 26px;
    margin: 0;
    cursor: pointer;
}

.cc-ps-cookies-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.cc-ps-cookies-slider {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--cck-text) 22%, transparent);
    border-radius: 999px;
    transition: background-color .2s;
    pointer-events: none;
}

.cc-ps-cookies-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}

.cc-ps-cookies-switch input:checked + .cc-ps-cookies-slider {
    background: var(--cck-primary-bg);
}

.cc-ps-cookies-switch input:checked + .cc-ps-cookies-slider::before {
    transform: translateX(18px);
}

/* Lista plików cookie w grupie */
.cc-ps-cookies-group-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 0;
    padding: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--cck-text);
    background: none;
    border: 0;
    cursor: pointer;
}

.cc-ps-cookies-chevron {
    width: 7px;
    height: 7px;
    margin-top: -3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform .2s, margin .2s;
}

.cc-ps-cookies-group-toggle[aria-expanded="true"] .cc-ps-cookies-chevron {
    margin-top: 3px;
    transform: rotate(-135deg);
}

.cc-ps-cookies-banner .collapse {
    display: none;
}

.cc-ps-cookies-banner .collapse.show {
    display: block;
}

.cc-ps-cookies-list {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.cc-ps-cookies-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
    padding: 8px 0;
    border-top: 1px solid var(--cck-line);
    font-size: 13px;
}

.cc-ps-cookies-item-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--cck-text);
}

.cc-ps-cookies-item-blocked {
    font-size: 12px;
    color: #c0392b;
}

.cc-ps-cookies-item-description {
    flex-basis: 100%;
    color: var(--cck-muted);
}

/* Okno ustawień zawsze na środku ekranu */
.cc-ps-cookies-banner.cc-is-prefs {
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    left: 50% !important;
    width: min(560px, calc(100vw - 32px));
    max-width: none !important;
    transform: translate(-50%, -50%) !important;
    animation: cck-fade .25s ease both;
}

.cc-ps-cookies-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(15, 23, 42, .45);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: cck-fade .25s ease both;
}

.cc-ps-cookies-backdrop[hidden] {
    display: none;
}

/* Położenie (styl Pudełko i Chmurka) */
.cc-position-top-left { top: 16px; left: 16px; }
.cc-position-top-right { top: 16px; right: 16px; }
.cc-position-top-center { top: 16px; left: 50%; transform: translateX(-50%); }
.cc-position-middle-left { top: 50%; left: 16px; transform: translateY(-50%); }
.cc-position-middle-right { top: 50%; right: 16px; transform: translateY(-50%); }
.cc-position-middle-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.cc-position-bottom-left { bottom: 16px; left: 16px; }
.cc-position-bottom-right { bottom: 16px; right: 16px; }
.cc-position-bottom-center { bottom: 16px; left: 50%; transform: translateX(-50%); }

/* Styl Pasek: na całą szerokość, treść i przyciski w jednym rzędzie */
.cc-style-bar:not(.cc-is-prefs) {
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    padding: 18px 24px;
    border-width: 0;
    border-radius: 0;
}

.cc-style-bar.cc-position-top:not(.cc-is-prefs) { top: 0; border-bottom-width: 1px; }
.cc-style-bar.cc-position-bottom:not(.cc-is-prefs),
.cc-style-bar.cc-position-middle:not(.cc-is-prefs) { bottom: 0; border-top-width: 1px; }

.cc-style-bar .cc-ps-cookies-main {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.cc-style-bar .cc-ps-cookies-main .cc-ps-cookies-text {
    flex: 1 1 auto;
}

.cc-style-bar .cc-ps-cookies-main .cc-ps-cookies-buttons {
    flex: none;
    margin-top: 0;
}

/* Styl Chmurka: większe zaokrąglenie i przyciemnione tło strony */
.cc-style-cloud:not(.cc-is-prefs) {
    padding: 28px;
    border-radius: calc(var(--cck-radius) * 1.5);
}

/* Telefony: panel przyklejony do dołu ekranu */
@media (max-width: 575px) {
    .cc-ps-cookies-banner:not(.cc-is-prefs) {
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100%;
        max-width: none;
        padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
        border-width: 1px 0 0;
        border-radius: var(--cck-radius) var(--cck-radius) 0 0;
        transform: none !important;
    }

    .cc-style-bar .cc-ps-cookies-main {
        display: block;
    }

    .cc-style-bar .cc-ps-cookies-main .cc-ps-cookies-buttons {
        margin-top: 16px;
    }

    .cc-ps-cookies-banner.cc-is-prefs {
        width: calc(100vw - 16px);
        padding: 20px 16px;
    }

    .cc-ps-cookies-buttons {
        flex-direction: column-reverse;
    }

    .cc-ps-cookies-btn {
        width: 100%;
        flex: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cc-ps-cookies-banner,
    .cc-ps-cookies-backdrop {
        animation: none;
    }

    .cc-ps-cookies-btn,
    .cc-ps-cookies-slider,
    .cc-ps-cookies-slider::before,
    .cc-ps-cookies-chevron {
        transition: none;
    }
}

/* Ikonka ustawień po wyrażeniu zgody */
.cc-ps-cookies-mini-banner {
    position: fixed;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px -6px rgba(16, 24, 40, .35);
    cursor: pointer;
    transition: transform .25s cubic-bezier(.2, .8, .2, 1);
    animation: cck-fade .3s ease both;
}

#cc-ps-cookies-settings-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    color: inherit;
    background: none;
    border: 0;
    border-radius: inherit;
    cursor: pointer;
}
