/* ============================================================================
   Cookie Consent — bottom-sheet banner z inline-expandowalnymi szczegółami.

   Jeden element na stronie. Bez modalu, bez backdrop'u, bez blokowania strony.
   Kliknięcie „Dostosuj" rozwija sekcję z togglami w TYM SAMYM bannerze.

   Ładowany na każdej stronie przez header.php. Używa tokenów :root z kalkulatora
   (`var(--primary)`) z fallbackiem na hardcoded brand colors, więc działa też
   na portalu root / quiz, gdzie tokeny mogą być inne.
   ============================================================================ */

.cookie-consent {
    --cc-primary: var(--primary, #1769d4);
    --cc-primary-dark: var(--primary-dark, #1255b0);
    --cc-bg: #fff;
    --cc-text: #1a2236;
    --cc-text-muted: #5b6a85;
    --cc-border: #dde3ef;
    --cc-radius: 10px;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Banner (bottom sheet) ────────────────────────────────────────────────── */
.cookie-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cc-bg);
    border-top: 1px solid var(--cc-border);
    box-shadow: 0 -8px 32px rgba(15, 30, 60, 0.10);
    z-index: 9999;
    padding: 20px 24px;
    max-height: 90vh;
    overflow-y: auto;
    animation: cc-slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cc-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.cc-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cc-text { flex: 1; min-width: 0; }

.cc-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cc-text);
    margin: 0 0 6px;
    line-height: 1.3;
}

.cc-desc {
    font-size: 0.88rem;
    color: var(--cc-text-muted);
    line-height: 1.55;
    margin: 0;
}

.cc-link {
    color: var(--cc-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.cc-link:hover { color: var(--cc-primary-dark); }

.cc-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 768px) {
    .cc-content {
        flex-direction: row;
        align-items: center;
        gap: 32px;
    }
    .cc-actions {
        flex-direction: row;
        flex-shrink: 0;
    }
}

/* ── Przyciski ────────────────────────────────────────────────────────────── */
.cc-btn {
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--cc-radius);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
    white-space: nowrap;
    line-height: 1.2;
}

.cc-btn:active { transform: scale(0.98); }

.cc-btn-primary {
    background: var(--cc-primary);
    color: #fff;
    border-color: var(--cc-primary);
}
.cc-btn-primary:hover {
    background: var(--cc-primary-dark);
    border-color: var(--cc-primary-dark);
}

.cc-btn-secondary {
    background: #fff;
    color: var(--cc-text);
    border-color: var(--cc-border);
}
.cc-btn-secondary:hover {
    background: #f4f7fb;
    border-color: #c8d0de;
}

/* Tertiary — subtelny outline button (mniej widoczny niż secondary).
   Spójny wygląd na mobile i desktop (bez underline / link-style). */
.cc-btn-tertiary {
    background: transparent;
    color: var(--cc-text-muted);
    border-color: var(--cc-border);
}
.cc-btn-tertiary:hover {
    background: #fafbfd;
    border-color: #c8d0de;
    color: var(--cc-text);
}

.cc-btn:focus-visible {
    outline: 2px solid var(--cc-primary);
    outline-offset: 2px;
}

/* ── Rozwijane szczegóły (inline, w tym samym bannerze) ───────────────────── */
.cookie-consent-details {
    max-width: 1200px;
    margin: 16px auto 0;
    animation: cc-expand 0.25s ease-out both;
}

@keyframes cc-expand {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.cc-details-inner {
    /* Layout treści w rozszerzonej sekcji — identyczny z resztą banner */
}

/* ── Kategorie ────────────────────────────────────────────────────────────── */
.cc-category {
    border-top: 1px solid var(--cc-border);
    padding: 14px 0;
}
/* Pierwsza kategoria bez border-top — eliminujemy dublującą się linię
   pod opisem polityki (druga linia od .cookie-consent-details też usunięta). */
.cc-category:first-of-type { border-top: none; padding-top: 4px; }
.cc-category:last-of-type { border-bottom: 1px solid var(--cc-border); }

.cc-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

.cc-category-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--cc-text);
    margin: 0;
}

.cc-category-desc {
    font-size: 0.82rem;
    color: var(--cc-text-muted);
    line-height: 1.5;
    margin: 0;
}

/* ── Toggle (switch) ──────────────────────────────────────────────────────── */
.cc-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.cc-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.cc-toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    background: #cdd5e3;
    border-radius: 999px;
    transition: background 0.2s ease;
}
.cc-toggle-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.cc-toggle input:checked + .cc-toggle-switch {
    background: var(--cc-primary);
}
.cc-toggle input:checked + .cc-toggle-switch::after {
    transform: translateX(18px);
}
.cc-toggle input:focus-visible + .cc-toggle-switch {
    outline: 2px solid var(--cc-primary);
    outline-offset: 2px;
}
.cc-toggle-label {
    /* Wyłącznie dla screen readerów — wizualnie schowane */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cc-toggle-pill-disabled {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--cc-primary);
    background: rgba(23, 105, 212, 0.08);
    padding: 5px 12px;
    border-radius: 999px;
}

/* ── Floating reopen button (lustrzane do .fw-trigger po prawej) ──────────── */
/* UWAGA: .cc-reopen jest POZA .cookie-consent w DOM, więc nie dziedziczy
   tokenów --cc-* z tamtego scope. Sięgamy bezpośrednio do --primary z :root
   kalkulatora; hardcoded fallback gwarantuje działanie również na stronach
   bez --primary w :root. */
.cc-reopen {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9000;
    width: 48px;
    height: 48px;
    border-radius: 24px;
    background: var(--primary, #1769d4);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(23, 105, 212, 0.20);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: background 0.2s ease,
                transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
    animation: cc-reopen-in 0.35s ease-out both;
}

@keyframes cc-reopen-in {
    from { opacity: 0; transform: translateY(8px) scale(0.85); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.cc-reopen:hover {
    background: var(--primary-dark, #1255b0);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(23, 105, 212, 0.28);
}

.cc-reopen:focus-visible {
    outline: 3px solid rgba(23, 105, 212, 0.4);
    outline-offset: 2px;
}

.cc-reopen[hidden] {
    display: none;
}

/* Mobile — mniejsza ikonka i bliżej krawędzi, żeby nie przeszkadzała */
@media (max-width: 600px) {
    .cc-reopen {
        bottom: 16px;
        left: 16px;
        width: 42px;
        height: 42px;
    }
}
