/**
 * Unit Cookies — Banner CSS v2.0.0
 * RODO/ePrivacy compliant: równorzędne przyciski, brak dark patterns
 */

/* ── CSS zmienne (nadpisywane inline z JS/admina) ── */
#uc-banner {
    --uc-bg:      #fff;
    --uc-text:    #1a1a1a;
    --uc-accent:  #374151;
    --uc-btxt:    #fff;
    --uc-muted:   #6b7280;
    --uc-radius:  4px;
    --uc-shadow:  0 -2px 20px rgba(0,0,0,.10);
    --uc-border:  rgba(0,0,0,.08);
    --uc-meta-bg: rgba(0,0,0,.04);

    position: fixed;
    z-index: 999999;
    background: var(--uc-bg);
    color: var(--uc-text);
    box-shadow: var(--uc-shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;

    /* Wejście animowane */
    opacity: 0;
    transition: opacity .32s ease, transform .32s ease;
}

#uc-banner.uc-visible  { opacity: 1; }
#uc-banner.uc-hiding   { opacity: 0; pointer-events: none; }

/* ── Pozycje ── */

/* CENTER — modal z overlayem */
#uc-banner.uc-pos-center {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: transparent;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    transform: none;
}
/* Overlay pod modalem */
#uc-banner.uc-pos-center::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: -1;
    opacity: 0;
    transition: opacity .32s ease;
}
#uc-banner.uc-pos-center.uc-visible::before { opacity: 1; }
#uc-banner.uc-pos-center.uc-hiding::before  { opacity: 0; }

/* Okno modalu */
#uc-banner.uc-pos-center .uc-inner {
    background: var(--uc-bg);
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0,0,0,.28);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 32px;
    transform: scale(.96) translateY(12px);
    transition: transform .32s ease;
}
#uc-banner.uc-pos-center.uc-visible .uc-inner { transform: scale(1) translateY(0); }
#uc-banner.uc-pos-center.uc-hiding  .uc-inner { transform: scale(.96) translateY(12px); }

/* W modalu przyciski pionowo, pełna szerokość */
#uc-banner.uc-pos-center .uc-layer1      { flex-direction: column; gap: 16px; }
#uc-banner.uc-pos-center .uc-layer1-text { flex: 0 0 auto; width: 100%; }
#uc-banner.uc-pos-center .uc-btns        { flex-direction: column; width: 100%; min-width: 0; }
#uc-banner.uc-pos-center .uc-btn         { width: 100%; }

/* BOTTOM / TOP — paski */
#uc-banner.uc-pos-bottom,
#uc-banner.uc-pos-top { left: 0; right: 0; }

#uc-banner.uc-pos-bottom { bottom: 0; border-top: 3px solid var(--uc-accent); transform: translateY(12px); }
#uc-banner.uc-pos-bottom.uc-visible { transform: translateY(0); }
#uc-banner.uc-pos-bottom.uc-hiding  { transform: translateY(12px); }

#uc-banner.uc-pos-top { top: 0; border-bottom: 3px solid var(--uc-accent); transform: translateY(-12px); }
#uc-banner.uc-pos-top.uc-visible { transform: translateY(0); }
#uc-banner.uc-pos-top.uc-hiding  { transform: translateY(-12px); }

/* CORNER — rogi */
#uc-banner.uc-pos-bottom-left,
#uc-banner.uc-pos-bottom-right {
    bottom: 16px;
    width: min(380px, calc(100vw - 32px));
    border: 1px solid var(--uc-border);
    border-top: 3px solid var(--uc-accent);
    border-radius: var(--uc-radius);
    transform: translateY(16px);
}
#uc-banner.uc-pos-bottom-left  { left: 16px; }
#uc-banner.uc-pos-bottom-right { right: 16px; }
#uc-banner.uc-pos-bottom-left.uc-visible,
#uc-banner.uc-pos-bottom-right.uc-visible  { transform: translateY(0); }
#uc-banner.uc-pos-bottom-left.uc-hiding,
#uc-banner.uc-pos-bottom-right.uc-hiding   { transform: translateY(16px); }

/* ── Inner wrapper ── */
.uc-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 28px;
}
#uc-banner.uc-pos-bottom-left  .uc-inner,
#uc-banner.uc-pos-bottom-right .uc-inner { max-width: 100%; padding: 16px 18px; }

/* ── Warstwa 1: tytuł + tekst + przyciski ── */
.uc-layer1 {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}
.uc-layer1-text { flex: 1 1 300px; min-width: 0; }

.uc-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--uc-text);
}
.uc-text {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--uc-text);
    opacity: .82;
}
.uc-policy {
    display: inline-block;
    font-size: 12px;
    color: var(--uc-accent);
    text-decoration: underline;
    margin-bottom: 2px;
}
.uc-policy:hover { opacity: .7; }

/* ── Przyciski ──
   RODO: "Akceptuj" i "Odrzuć" muszą być równorzędne wizualnie.
   Oba przyciski pierwszej warstwy mają identyczny styl.
─────────────────────────────────────────────────────── */
.uc-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
    flex-shrink: 0;
}
.uc-btn {
    display: block;
    width: 100%;
    padding: 10px 20px;
    border: 2px solid var(--uc-accent);
    border-radius: var(--uc-radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition: opacity .18s, background .18s;
    white-space: nowrap;
}
.uc-btn:focus-visible {
    outline: 3px solid var(--uc-accent);
    outline-offset: 3px;
}

/* Oba przyciski pierwszej warstwy — filled — RÓWNORZĘDNE */
.uc-btn-primary {
    background: var(--uc-accent);
    border-color: var(--uc-accent);
    color: var(--uc-btxt);
}
.uc-btn-primary:hover { opacity: .82; }

/* Trzeci przycisk "Dostosuj" — subtelny link, nie konkuruje z główną decyzją */
.uc-btn-link {
    background: transparent;
    border-color: transparent;
    color: var(--uc-text);
    font-weight: 400;
    font-size: 12px;
    opacity: .65;
    padding: 4px 0;
    text-decoration: underline;
    text-align: center;
    width: auto;
}
.uc-btn-link:hover { opacity: 1; }

/* ── Warstwa 2: kategorie cookies ── */
.uc-layer2 {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--uc-border);
}

.uc-types {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.uc-type {
    background: var(--uc-meta-bg);
    border-radius: var(--uc-radius);
    padding: 12px 14px;
    border: 1px solid var(--uc-border);
}
.uc-type-locked { border-left: 3px solid #2E7A4D; }

.uc-type-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}
.uc-type-label {
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    flex: 1;
}
.uc-type-locked .uc-type-label { cursor: default; }

.uc-type-desc {
    margin: 0 0 6px;
    font-size: 12px;
    opacity: .72;
    line-height: 1.4;
}

.uc-type-meta {
    font-size: 11px;
    opacity: .62;
    margin-top: 4px;
    line-height: 1.4;
}
.uc-type-meta code {
    font-family: monospace;
    font-size: 10.5px;
    background: rgba(0,0,0,.06);
    padding: 0 3px;
    border-radius: 2px;
}

/* Odznaka "Zawsze aktywne" */
.uc-lock-badge {
    font-size: 11px;
    font-weight: 700;
    color: #2E7A4D;
    background: rgba(46,122,77,.12);
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Toggle switch (WCAG AA) ── */
.uc-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}
.uc-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.uc-slider {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.22);
    border-radius: 24px;
    transition: background .2s;
}
.uc-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.uc-switch input:checked + .uc-slider { background: var(--uc-accent); }
.uc-switch input:checked + .uc-slider::before { transform: translateX(18px); }
.uc-switch input:focus-visible + .uc-slider {
    outline: 3px solid var(--uc-accent);
    outline-offset: 2px;
}

/* Przycisk Zapisz */
.uc-btns-save { margin-top: 8px; }
.uc-btns-save .uc-btn {
    width: auto;
    display: inline-block;
    background: var(--uc-muted);
    border-color: var(--uc-muted);
}

/* ── Stały przycisk ZARZĄDZAJ ── */
#uc-manage-btn {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 99998;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid rgba(0,0,0,.18);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    transition: box-shadow .18s, opacity .18s;
    opacity: 0;
    pointer-events: none;
    font-family: inherit;
}
#uc-manage-btn.uc-manage-visible {
    opacity: 1;
    pointer-events: auto;
}
#uc-manage-btn:hover { box-shadow: 0 4px 14px rgba(0,0,0,.18); }
#uc-manage-btn:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}
#uc-manage-btn svg { flex-shrink: 0; }

/* Gdy banner w pozycji bottom-left — przesuń przycisk zarządzania */
.uc-pos-bottom-left ~ #uc-manage-btn { left: 16px; bottom: 80px; }

/* ── Shortcode link [unit_cookies_link] ── */
.uc-open-btn {
    background: none;
    border: none;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
    padding: 0;
}
.uc-open-btn:hover { opacity: .7; }

/* ── Responsywność ── */
@media (max-width: 640px) {
    .uc-inner { padding: 14px 16px; }

    .uc-layer1 { flex-direction: column; gap: 14px; }
    .uc-btns { flex-direction: column; width: 100%; min-width: 0; }
    .uc-btn  { width: 100%; }
    .uc-btn-link { width: 100%; }

    .uc-types { grid-template-columns: 1fr; }

    /* Modal na mobile — pełna szerokość, mała przerwa od krawędzi */
    #uc-banner.uc-pos-center { padding: 12px; align-items: flex-end; }
    #uc-banner.uc-pos-center .uc-inner {
        max-height: 85vh;
        padding: 20px 18px;
        border-radius: 10px 10px 6px 6px;
    }

    #uc-banner.uc-pos-bottom-left,
    #uc-banner.uc-pos-bottom-right {
        left: 0; right: 0; bottom: 0;
        width: auto;
        border-left: none;
        border-right: none;
        border-radius: 0;
        border-top: 3px solid var(--uc-accent);
    }

    #uc-manage-btn { bottom: 12px; left: 12px; }
}

/* ── Accessibility: reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    #uc-banner, .uc-slider, .uc-slider::before { transition: none; }
}
