/* Cookie Consent */

/*
   Lokalne kolory dla komponentu cookies.
   Nie zmieniają kolorów całej strony.
*/
.cookie-banner,
.cookie-modal {
    --cookie-bg: #111111;
    --cookie-text: #ffffff;
    --cookie-muted: #a9a9b3;
    --cookie-line: #60606a;
    --cookie-violet: #7464d8;
    --cookie-violet-hover: #6857c7;
    --cookie-focus: #a99cff;
}


/* Cookie Consent Banner */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;

    max-width: 450px;

    background: var(--cookie-bg);
    color: var(--cookie-text);

    border: 1px solid var(--cookie-line);
    border-radius: 12px;

    padding: 24px;

    z-index: 9999;

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

    font-family: var(--sans);

    transform: translateY(120%);
    visibility: hidden;

    transition:
        transform 0.4s ease-out,
        visibility 0.4s;
}

.cookie-banner.show {
    transform: translateY(0);
    visibility: visible;
}


/* Banner heading */
.cookie-banner h2 {
    margin: 0 0 10px 0;

    font-size: 18px;
    line-height: 1.3;
    font-weight: 500;

    color: var(--cookie-text);
}


/* Banner description */
.cookie-banner p {
    margin: 0 0 20px 0;

    font-size: 14px;
    line-height: 1.5;

    color: var(--cookie-muted);
}


/* Buttons container */
.cookie-banner .buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}


/* Cookie buttons */
.cookie-btn {
    padding: 10px 16px;

    font-size: 13px;
    line-height: 1.4;
    font-weight: 500;

    border-radius: 6px;

    cursor: pointer;

    border: 1px solid var(--cookie-line);

    background: transparent;
    color: var(--cookie-text);

    transition:
        background-color 0.2s,
        border-color 0.2s,
        color 0.2s;
}

.cookie-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}


/*
   Ciemniejszy fiolet niż globalny #9281f7.
   Dzięki temu biały tekst spełnia wymagany kontrast.
*/
.cookie-btn.primary {
    background: var(--cookie-violet);
    border-color: var(--cookie-violet);
    color: #ffffff;
}

.cookie-btn.primary:hover {
    background: var(--cookie-violet-hover);
    border-color: var(--cookie-violet-hover);
}


/* Keyboard focus */
.cookie-btn:focus-visible {
    outline: 3px solid var(--cookie-focus);
    outline-offset: 3px;
}


/* Cookie Modal Overlay */
.cookie-modal-overlay {
    position: fixed;

    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    background: rgba(0, 0, 0, 0.8);

    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity 0.3s,
        visibility 0.3s;
}

.cookie-modal-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}


/* Cookie Modal */
.cookie-modal {
    background: var(--cookie-bg);
    color: var(--cookie-text);

    border: 1px solid var(--cookie-line);
    border-radius: 12px;

    padding: 30px;

    max-width: 500px;
    width: 100%;

    max-height: 90vh;
    overflow-y: auto;
}


/* Modal title */
.cookie-modal h2 {
    margin: 0 0 15px 0;

    font-size: 22px;
    line-height: 1.3;
    font-weight: 500;

    color: var(--cookie-text);
}


/* Modal intro */
.cookie-modal > p {
    margin: 0 0 25px 0;

    font-size: 14px;
    line-height: 1.5;

    color: var(--cookie-muted);
}


/* Cookie categories */
.cookie-category {
    border-top: 1px solid var(--cookie-line);

    padding: 15px 0;
}

.cookie-category:last-of-type {
    border-bottom: 1px solid var(--cookie-line);

    margin-bottom: 25px;
}


/* Category header */
.category-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 20px;
}


/*
   consent.js używa teraz h3,
   nie h4.
*/
.category-header h3 {
    margin: 0;

    font-size: 16px;
    line-height: 1.4;
    font-weight: 500;

    color: var(--cookie-text);
}


/* Category description */
.category-desc {
    margin: 8px 0 0 0;

    font-size: 13px;
    line-height: 1.5;

    color: var(--cookie-muted);
}


/* Toggle Switch */
.toggle-switch {
    position: relative;

    display: inline-block;

    flex: 0 0 auto;

    width: 44px;
    height: 24px;

    cursor: pointer;
}


/*
   Checkbox pozostaje dostępny dla klawiatury
   i czytników ekranu.
*/
.toggle-switch input {
    position: absolute;

    width: 1px;
    height: 1px;

    margin: 0;
    padding: 0;

    opacity: 0;
}


/* Toggle background */
.slider {
    position: absolute;

    cursor: pointer;

    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    background-color: var(--cookie-line);

    border-radius: 24px;

    transition: background-color 0.3s;
}


/* Toggle handle */
.slider::before {
    position: absolute;

    content: "";

    height: 18px;
    width: 18px;

    left: 3px;
    bottom: 3px;

    background-color: #ffffff;

    border-radius: 50%;

    transition: transform 0.3s;
}


/* Active toggle */
.toggle-switch input:checked + .slider {
    background-color: var(--cookie-violet);
}


/* Active toggle handle */
.toggle-switch input:checked + .slider::before {
    transform: translateX(20px);
}


/* Keyboard focus */
.toggle-switch input:focus-visible + .slider {
    outline: 3px solid var(--cookie-focus);
    outline-offset: 3px;
}


/* Disabled necessary cookies */
.toggle-switch input:disabled + .slider {
    cursor: not-allowed;
}


/* Modal footer */
.cookie-modal-footer {
    display: flex;

    justify-content: flex-end;

    gap: 12px;
}


/* Mobile */
@media (max-width: 600px) {

    .cookie-banner {
        max-width: calc(100% - 40px);
    }

    .cookie-modal {
        padding: 20px;
    }

    .cookie-modal-footer {
        flex-direction: column;
    }

    .cookie-modal-footer .cookie-btn {
        width: 100%;

        text-align: center;
    }
}