/**
 * WozimySie.pl — Style wewnętrznego systemu zgód cookie (CMP)
 */

#cookie-consent {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
}

#cookie-consent .cc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    /* Blokuje interakcję ze stroną — wymusza świadomy wybór zgody */
    pointer-events: auto;
    animation: cc-fade-in 0.3s ease;
}

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

/* Blokada przewijania strony, dopóki baner jest otwarty */
html.cc-open,
html.cc-open body {
    overflow: hidden !important;
}

#cookie-consent .cc-box {
    position: relative;
    width: 100%;
    max-width: 1080px;
    margin: var(--spacing-md, 1rem);
    background: var(--color-bg, #fff);
    color: var(--color-text, #333);
    border-radius: var(--border-radius-lg, 8px);
    border-top: 5px solid var(--color-accent, #ff5722);
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.25), 0 12px 40px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
    font-family: var(--font-family);
    font-size: var(--font-size-sm, 0.875rem);
    line-height: var(--line-height, 1.6);
    animation: cc-slide-up 0.3s ease, cc-attention 0.6s ease 0.35s 2;
}

/* Delikatne „mrugnięcie" przyciągające wzrok po pojawieniu się */
@keyframes cc-attention {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.015); }
}

/* W trybie ustawień zachowuje się jak wyśrodkowany modal */
#cookie-consent:has(.cc-settings:not([hidden])) {
    align-items: center;
}

#cookie-consent:has(.cc-settings:not([hidden])) .cc-box {
    max-width: 560px;
    max-height: calc(100vh - 2 * var(--spacing-xl, 2rem));
    overflow-y: auto;
}

@keyframes cc-slide-up {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

#cookie-consent .cc-title {
    font-size: var(--font-size-lg, 1.125rem);
    margin: 0 0 var(--spacing-xs, 0.25rem);
    color: var(--color-secondary, #212121);
}

/* ── Baner ─────────────────────────────────────────────── */
#cookie-consent .cc-banner {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl, 2rem);
    padding: var(--spacing-lg, 1.5rem);
}

#cookie-consent .cc-banner__text p {
    margin: 0;
    color: var(--color-text-light, #666);
}

#cookie-consent .cc-banner__text a {
    color: var(--color-primary, #c62828);
    text-decoration: underline;
}

#cookie-consent .cc-banner__actions {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: var(--spacing-sm, 0.5rem);
    justify-content: flex-end;
}

/* ── Ustawienia ────────────────────────────────────────── */
#cookie-consent .cc-settings {
    padding: var(--spacing-lg, 1.5rem);
}

#cookie-consent .cc-cat {
    padding: var(--spacing-md, 1rem) 0;
    border-bottom: 1px solid var(--color-border-light, #eee);
}

#cookie-consent .cc-cat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md, 1rem);
}

#cookie-consent .cc-cat__name {
    font-weight: 600;
    color: var(--color-secondary, #212121);
}

#cookie-consent .cc-cat__badge {
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--color-success, #2e7d32);
    font-weight: 600;
}

#cookie-consent .cc-cat__desc {
    margin: var(--spacing-xs, 0.25rem) 0 0;
    color: var(--color-text-light, #666);
}

#cookie-consent .cc-settings__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm, 0.5rem);
    justify-content: flex-end;
    margin-top: var(--spacing-lg, 1.5rem);
}

/* ── Przyciski ─────────────────────────────────────────── */
#cookie-consent .cc-btn {
    font-family: inherit;
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    padding: 0.6rem 1.1rem;
    border-radius: var(--border-radius, 4px);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition, 0.2s ease), color var(--transition, 0.2s ease);
    white-space: nowrap;
}

#cookie-consent .cc-btn--primary {
    background: var(--color-primary, #c62828);
    color: var(--color-text-white, #fff);
    animation: cc-pulse 1.8s ease-in-out infinite;
}

#cookie-consent .cc-btn--primary:hover {
    background: var(--color-primary-dark, #a31f1f);
    animation: none;
}

/* Pulsujący CTA — zwraca uwagę na główną akcję */
@keyframes cc-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.55); }
    70%  { box-shadow: 0 0 0 12px rgba(198, 40, 40, 0); }
    100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0); }
}

/* Szacunek dla użytkowników z ograniczonymi animacjami */
@media (prefers-reduced-motion: reduce) {
    #cookie-consent .cc-box,
    #cookie-consent .cc-btn--primary {
        animation: none;
    }
}

#cookie-consent .cc-btn--secondary {
    background: var(--color-bg-light, #f5f5f5);
    color: var(--color-secondary, #212121);
    border-color: var(--color-border, #e0e0e0);
}

#cookie-consent .cc-btn--secondary:hover {
    background: var(--color-border-light, #eee);
}

#cookie-consent .cc-btn--ghost {
    background: transparent;
    color: var(--color-text-light, #666);
    text-decoration: underline;
}

#cookie-consent .cc-btn--ghost:hover {
    color: var(--color-secondary, #212121);
}

/* ── Przełącznik (switch) ──────────────────────────────── */
#cookie-consent .cc-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

#cookie-consent .cc-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

#cookie-consent .cc-switch__slider {
    position: absolute;
    inset: 0;
    background: var(--color-text-muted, #999);
    border-radius: 24px;
    transition: background var(--transition, 0.2s ease);
}

#cookie-consent .cc-switch__slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition, 0.2s ease);
}

#cookie-consent .cc-switch input:checked + .cc-switch__slider {
    background: var(--color-success, #2e7d32);
}

#cookie-consent .cc-switch input:checked + .cc-switch__slider::before {
    transform: translateX(20px);
}

#cookie-consent .cc-switch input:focus-visible + .cc-switch__slider {
    box-shadow: 0 0 0 2px var(--color-bg, #fff), 0 0 0 4px var(--color-primary, #c62828);
}

/* ── Responsywność ─────────────────────────────────────── */
@media (max-width: 768px) {
    #cookie-consent .cc-banner {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md, 1rem);
    }

    #cookie-consent .cc-banner__actions {
        justify-content: stretch;
    }

    #cookie-consent .cc-banner__actions .cc-btn {
        flex: 1 1 auto;
    }
}
