/* =========================================================
   SDBau – Einwilligungs-Banner
   Gleichwertige Buttons "Alle ablehnen" / "Alle akzeptieren" (kein Nudging),
   echte Checkbox-Schalter (role="switch"), mobil als Bottom-Sheet.
   ========================================================= */

.cc-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
}

    .cc-backdrop.is-visible {
        opacity: 1;
    }

    .cc-backdrop[hidden],
    .cc[hidden] {
        display: none;
    }

.cc {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 99999;
    width: min(540px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.3);
    font-size: 0.9rem;
    line-height: 1.55;
    opacity: 0;
    transform: translate(-50%, 16px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

    .cc.is-visible {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    .cc:focus {
        outline: none;
    }

.cc__sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.cc__scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 24px 8px;
    overscroll-behavior: contain;
}

.cc__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.cc__logo {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    color: #fff;
    font-size: 1.1rem;
}

.cc__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
}

.cc__text {
    margin: 0 0 16px;
    color: #475569;
    font-size: 0.85rem;
}

    .cc__text a,
    .cc__links a,
    .cc__details summary {
        color: #0369a1;
        font-weight: 600;
        text-decoration: underline;
        text-underline-offset: 2px;
    }

/* ---------- Kategorien ---------- */
.cc__list {
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    display: grid;
    gap: 8px;
}

.cc__item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

    .cc__item:hover {
        border-color: #cbd5e1;
    }

    .cc__item.is-on {
        border-color: #7dd3fc;
        background: #f0f9ff;
    }

div.cc__item {
    cursor: default;
}

.cc__icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.9rem;
}

.cc__icon--essential { background: #dbeafe; color: #1d4ed8; }
.cc__icon--functional { background: #dcfce7; color: #15803d; }
.cc__icon--analytics { background: #fef3c7; color: #b45309; }
.cc__icon--marketing { background: #fce7f3; color: #be185d; }

.cc__label {
    min-width: 0;
}

    .cc__label strong {
        display: block;
        font-size: 0.92rem;
        font-weight: 700;
        color: #0f172a;
    }

    .cc__label small {
        display: block;
        font-size: 0.78rem;
        color: #64748b;
        line-height: 1.4;
    }

.cc__always {
    padding: 3px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Schalter: echte Checkbox, nur optisch umgestaltet */
.cc__switch {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 46px;
    height: 26px;
    margin: 0;
    flex-shrink: 0;
    border-radius: 999px;
    background: #cbd5e1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

    .cc__switch::after {
        content: "";
        position: absolute;
        top: 3px;
        left: 3px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
        transition: transform 0.2s ease;
    }

    .cc__switch:checked {
        background: #0284c7;
    }

        .cc__switch:checked::after {
            transform: translateX(20px);
        }

    .cc__switch:focus-visible {
        outline: 3px solid #0f172a;
        outline-offset: 2px;
    }

/* ---------- Details ---------- */
.cc__details {
    margin: 4px 0 12px;
}

    .cc__details summary {
        cursor: pointer;
        font-size: 0.82rem;
        padding: 4px 0;
    }

    .cc__details h3 {
        margin: 14px 0 6px;
        font-size: 0.82rem;
        font-weight: 700;
        color: #334155;
    }

.cc__table {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

    .cc__table table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.74rem;
    }

    .cc__table th,
    .cc__table td {
        padding: 6px 8px;
        text-align: left;
        vertical-align: top;
        border-top: 1px solid #e2e8f0;
        color: #475569;
    }

    .cc__table th {
        border-top: 0;
        background: #f1f5f9;
        color: #334155;
        font-weight: 700;
    }

/* ---------- Buttons ---------- */
.cc__actions {
    padding: 14px 24px 16px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.cc__buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cc__btn {
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 12px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

    .cc__btn:focus-visible {
        outline: 3px solid #0f172a;
        outline-offset: 2px;
    }

/* Beide Hauptentscheidungen gleich prominent */
.cc__btn--choice {
    border: 2px solid #0284c7;
    background: #0284c7;
    color: #fff;
}

    .cc__btn--choice:hover {
        background: #0369a1;
        border-color: #0369a1;
    }

.cc__btn--save {
    width: 100%;
    margin-top: 10px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
}

    .cc__btn--save:hover {
        background: #f1f5f9;
    }

.cc__links {
    margin: 10px 0 0;
    text-align: center;
    font-size: 0.75rem;
}

    .cc__links a {
        color: #64748b;
        font-weight: 500;
    }

/* ---------- Formular-Sperre ohne Einwilligung (reCAPTCHA) ---------- */
.form-cookie-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.96);
    text-align: center;
}

    .form-cookie-overlay i {
        margin-bottom: 1rem;
        font-size: 2.5rem;
        color: #f59e0b;
    }

    .form-cookie-overlay h4 {
        margin: 0 0 0.5rem;
        font-size: 1.1rem;
        font-weight: 700;
        color: #0f172a;
    }

    .form-cookie-overlay p {
        max-width: 380px;
        margin: 0 0 1rem;
        font-size: 0.9rem;
        line-height: 1.5;
        color: #64748b;
    }

    .form-cookie-overlay .btn-cookie-accept {
        padding: 0.625rem 1.5rem;
        border: none;
        border-radius: 10px;
        background: linear-gradient(135deg, #0ea5e9, #0369a1);
        color: #fff;
        font-weight: 600;
        font-size: 0.9rem;
        cursor: pointer;
    }

/* ---------- Mobil: Bottom-Sheet ---------- */
@media (max-width: 640px) {
    .cc {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 88vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(24px);
    }

        .cc.is-visible {
            transform: translateY(0);
        }

    .cc__scroll {
        padding: 18px 16px 6px;
    }

    .cc__actions {
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    }

    .cc__item {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        gap: 10px;
        padding: 10px 12px;
    }

    .cc__icon {
        width: 32px;
        height: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cc,
    .cc-backdrop,
    .cc__switch,
    .cc__switch::after {
        transition: none;
    }
}

@media print {
    .cc,
    .cc-backdrop {
        display: none !important;
    }
}
