/* ==========================================================================
   PLIKI COOKIES I ZGODA PRZEGLĄDARKI (assets/css/cookies.css)
   --------------------------------------------------------------------------
   Zawiera styl dwóch elementów:
     1. Kompaktowego pływającego komunikatu na dole ekranu (#cookie-banner),
        który nie blokuje strony i pozwala jednym kliknięciem zaakceptować
        wszystkie opcje, zostawić tylko niezbędne albo otworzyć ustawienia.
     2. Okna modalnego szczegółowych ustawień (#cookie-modal), w którym można
        włączyć lub wyłączyć zapamiętywanie preferencji interfejsu.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. PŁYWAJĄCY KOMUNIKAT COOKIES (#cookie-banner)
   -------------------------------------------------------------------------- */
/* Umieszczamy go w lewym dolnym rogu desktopu, żeby NIE zasłaniał czatu Fuksio AI po prawej stronie w edytorze. */
.cookie-banner {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 1400;
    width: min(440px, calc(100vw - 40px));
    padding: 18px 20px;
    border-radius: 22px;
    background: var(--glass-bg, rgba(255, 252, 247, 0.94));
    border: 1px solid var(--glass-border, rgba(160, 120, 80, 0.25));
    box-shadow:
        0 20px 50px rgba(34, 24, 16, 0.2),
        0 4px 14px rgba(34, 24, 16, 0.08);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: cookieBannerSlideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.cookie-banner[hidden] {
    display: none !important;
}

@keyframes cookieBannerSlideIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.dark-mode .cookie-banner {
    background: rgba(15, 22, 36, 0.94);
    border-color: rgba(0, 240, 255, 0.22);
    box-shadow:
        0 24px 56px rgba(0, 0, 0, 0.55),
        0 0 24px rgba(0, 240, 255, 0.08);
}

.cookie-banner-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cookie-banner-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent-orange) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-orange) 32%, transparent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.cookie-banner-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.25;
}

.cookie-banner-text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.cookie-banner-text a {
    color: var(--accent-orange);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Równorzędne przyciski wyboru — brak tzw. "dark patterns", opcja odrzucenia jest równie czytelna co akceptacja */
.cookie-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.cookie-btn {
    border-radius: 11px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 9px 13px;
    cursor: pointer;
    transition: transform 0.14s ease, background-color 0.18s ease, border-color 0.18s ease;
    min-height: 38px;
}

.cookie-btn-accept {
    background: var(--accent-orange);
    color: #ffffff;
    border: 1px solid transparent;
    flex: 1 1 auto;
}

body.dark-mode .cookie-btn-accept {
    color: #0b0f19;
}

.cookie-btn-accept:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.cookie-btn-essential {
    background: var(--subtle-pill-bg);
    color: var(--text-primary);
    border: 1px solid var(--hairline-border);
    flex: 1 1 auto;
}

.cookie-btn-essential:hover {
    border-color: var(--accent-orange);
}

.cookie-btn-settings {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--hairline-border);
    padding: 9px 12px;
}

.cookie-btn-settings:hover {
    color: var(--text-primary);
    border-color: var(--accent-orange);
}

/* Na telefonach podnosimy komunikat nad dolny pasek nawigacji (#mobile-dock) */
@media (max-width: 820px) {
    .cookie-banner {
        left: 12px;
        right: 12px;
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));
        width: auto;
        padding: 16px;
        border-radius: 18px;
    }

    .cookie-banner-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .cookie-btn-settings {
        grid-column: 1 / -1;
    }
}

/* --------------------------------------------------------------------------
   2. MODAL SZCZEGÓŁOWYCH USTAWIEŃ COOKIES (#cookie-modal)
   -------------------------------------------------------------------------- */
.cookie-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: rgba(15, 20, 32, 0.56);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cookie-modal-backdrop[hidden] {
    display: none !important;
}

.cookie-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10050;
    width: min(560px, calc(100vw - 28px));
    max-height: min(86vh, 680px);
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    background: var(--glass-bg, rgba(255, 252, 247, 0.98));
    border: 1px solid var(--glass-border, rgba(160, 120, 80, 0.25));
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
    overflow: hidden;
    color: var(--text-primary);
}

.cookie-modal[hidden] {
    display: none !important;
}

body.dark-mode .cookie-modal {
    background: rgba(16, 23, 38, 0.98);
    border-color: rgba(0, 240, 255, 0.25);
}

.cookie-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--hairline-border);
}

.cookie-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
}

.cookie-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--hairline-border);
    background: var(--subtle-pill-bg);
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cookie-modal-body {
    padding: 18px 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cookie-modal-intro {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.cookie-category-card {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--hairline-border);
    background: var(--subtle-pill-bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cookie-category-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cookie-category-top strong {
    font-size: 0.96rem;
    color: var(--text-primary);
}

.cookie-badge-locked {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-orange) 14%, transparent);
    color: var(--accent-orange);
    border: 1px solid color-mix(in srgb, var(--accent-orange) 32%, transparent);
    white-space: nowrap;
}

.cookie-toggle-btn {
    border-radius: 999px;
    border: 1px solid var(--hairline-border);
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 5px 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

body.dark-mode .cookie-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
}

.cookie-toggle-btn[aria-pressed="true"] {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: #ffffff;
}

body.dark-mode .cookie-toggle-btn[aria-pressed="true"] {
    color: #0b0f19;
}

.cookie-category-desc {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.cookie-category-keys {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.cookie-category-keys code {
    font-size: 0.76rem;
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(128, 128, 128, 0.14);
    color: var(--text-primary);
}

.cookie-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 22px 18px;
    border-top: 1px solid var(--hairline-border);
}

.cookie-modal-footer .cookie-privacy-link {
    margin-right: auto;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-orange);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   3. ZGODNOŚĆ Z TRYBEM WYSOKIEGO KONTRASTU I OGRANICZENIA RUCHU
   -------------------------------------------------------------------------- */
html.a11y-reduce-motion .cookie-banner {
    animation: none !important;
}

html.a11y-high-contrast .cookie-banner,
html.a11y-high-contrast .cookie-modal,
html.a11y-high-contrast .cookie-category-card {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
}

html.a11y-high-contrast .cookie-banner-title,
html.a11y-high-contrast .cookie-banner-text,
html.a11y-high-contrast .cookie-modal-header h2,
html.a11y-high-contrast .cookie-modal-intro,
html.a11y-high-contrast .cookie-category-top strong,
html.a11y-high-contrast .cookie-category-desc,
html.a11y-high-contrast .cookie-category-keys {
    color: #ffffff !important;
}

html.a11y-high-contrast .cookie-btn-accept,
html.a11y-high-contrast .cookie-toggle-btn[aria-pressed="true"] {
    background: #ffd400 !important;
    color: #000000 !important;
    border-color: #ffd400 !important;
}

html.a11y-high-contrast .cookie-btn-essential,
html.a11y-high-contrast .cookie-btn-settings,
html.a11y-high-contrast .cookie-modal-close,
html.a11y-high-contrast .cookie-toggle-btn[aria-pressed="false"] {
    background: #111111 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

html.a11y-high-contrast .cookie-banner a,
html.a11y-high-contrast .cookie-modal a {
    color: #ffd400 !important;
}
