/* =====================================================================
 * Conbro Cookie Banner
 * DSGVO/TTDSG-konform.
 * - Equal button hierarchy (Reject / Save selection / Accept all)
 * - Default: nur essential
 * - Kein eigener Cookie (nur localStorage)
 * - Reduced motion respektiert
 * - High contrast + prefers-color-scheme dark
 * ===================================================================== */

:root {
    --ccb-bg: rgba(15, 23, 42, 0.96);
    --ccb-bg-solid: #0f172a;
    --ccb-border: rgba(148, 163, 184, 0.22);
    --ccb-text: #e5e7eb;
    --ccb-muted: #94a3b8;
    --ccb-accent: #38bdf8;
    --ccb-accent-strong: #0ea5e9;
    --ccb-danger: #fca5a5;
    --ccb-radius: 12px;
    --ccb-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
    --ccb-z: 2147483600; /* unter Maximum, ueber allem anderen */
}

@media (prefers-color-scheme: light) {
    :root {
        --ccb-bg: rgba(255, 255, 255, 0.98);
        --ccb-bg-solid: #ffffff;
        --ccb-text: #0f172a;
        --ccb-muted: #475569;
        --ccb-border: rgba(15, 23, 42, 0.12);
    }
}

/* Verstecken bis JS sichtbar schaltet */
.ccb-banner--hidden { display: none !important; }

#ccb-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--ccb-z);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ccb-text);
    background: var(--ccb-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--ccb-border);
    box-shadow: var(--ccb-shadow);
    animation: ccb-slide-up 320ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

@media (prefers-reduced-motion: reduce) {
    #ccb-banner { animation: none; }
}

.ccb-banner__panel {
    max-width: 1080px;
    margin: 0 auto;
    padding: 18px 20px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px 24px;
    align-items: start;
}

.ccb-banner__intro {
    grid-column: 1 / -1;
}

.ccb-banner__title {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--ccb-accent);
}

.ccb-banner__desc {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--ccb-text);
    max-width: 70ch;
}

.ccb-banner__desc .ccb-link {
    color: var(--ccb-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.ccb-banner__desc .ccb-link:hover { color: #7dd3fc; }

.ccb-banner__details {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--ccb-border);
}

.ccb-banner__details[hidden] { display: none; }

.ccb-cat {
    border: 1px solid var(--ccb-border);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 0;
    background: rgba(2, 6, 23, 0.36);
}

@media (prefers-color-scheme: light) {
    .ccb-cat { background: rgba(15, 23, 42, 0.04); }
}

.ccb-cat__legend {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0;
    color: var(--ccb-text);
}

.ccb-cat__state {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ccb-muted);
    padding: 3px 8px;
    border: 1px solid var(--ccb-border);
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.08);
}

.ccb-cat__desc {
    margin: 6px 0 0;
    color: var(--ccb-muted);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.ccb-cat__row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    cursor: pointer;
    margin: 0;
}

.ccb-cat__row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--ccb-border);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    position: relative;
    margin: 1px 0 0;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.ccb-cat__row input[type="checkbox"]:hover { border-color: var(--ccb-accent); }
.ccb-cat__row input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--ccb-accent);
    outline-offset: 2px;
}

.ccb-cat__row input[type="checkbox"]:checked {
    background: var(--ccb-accent);
    border-color: var(--ccb-accent);
}
.ccb-cat__row input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid #00111f;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ccb-cat--essential {
    background: rgba(56, 189, 248, 0.05);
    border-color: rgba(56, 189, 248, 0.18);
}

.ccb-banner__actions {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: end;
    justify-content: flex-end;
}

.ccb-banner__intro + .ccb-banner__actions,
.ccb-banner__details + .ccb-banner__actions {
    grid-column: 2;
}

.ccb-btn {
    font: inherit;
    font-weight: 700;
    font-size: 0.8125rem;
    line-height: 1;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--ccb-border);
    background: transparent;
    color: var(--ccb-text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    white-space: nowrap;
}

.ccb-btn:hover { transform: translateY(-1px); }
.ccb-btn:active { transform: translateY(0); }
.ccb-btn:focus-visible { outline: 2px solid var(--ccb-accent); outline-offset: 2px; }

.ccb-btn--ghost {
    background: transparent;
    color: var(--ccb-muted);
}
.ccb-btn--ghost:hover { color: var(--ccb-text); border-color: var(--ccb-accent); }

.ccb-btn--secondary {
    background: rgba(2, 6, 23, 0.6);
    border-color: var(--ccb-border);
    color: var(--ccb-text);
}
.ccb-btn--secondary:hover { border-color: var(--ccb-danger); color: var(--ccb-danger); }

.ccb-btn--primary {
    background: linear-gradient(135deg, var(--ccb-accent), var(--ccb-accent-strong));
    color: #00111f;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.18);
}
.ccb-btn--primary:hover { box-shadow: 0 12px 32px rgba(56, 189, 248, 0.28); }

/* Reopen button (floating) */
.ccb-reopen {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: calc(var(--ccb-z) - 1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.92);
    color: var(--ccb-accent);
    border: 1px solid var(--ccb-border);
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s, opacity 0.2s;
    opacity: 0.75;
}
.ccb-reopen[hidden] { display: none !important; }
.ccb-reopen:hover { opacity: 1; transform: scale(1.05); }
.ccb-reopen:focus-visible { outline: 2px solid var(--ccb-accent); outline-offset: 2px; }

/* No-JS fallback */
.ccb-noscript-notice {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 2147483600;
    margin: 0;
    padding: 12px 16px;
    background: var(--ccb-bg-solid);
    color: var(--ccb-text);
    border: 1px solid var(--ccb-border);
    border-radius: 8px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 0.85rem;
}
.ccb-noscript-notice a { color: var(--ccb-accent); }

/* Mobile */
@media (max-width: 720px) {
    .ccb-banner__panel {
        grid-template-columns: 1fr;
        padding: 14px 16px 12px;
    }
    .ccb-banner__actions {
        grid-column: 1;
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .ccb-btn { width: 100%; padding: 12px 16px; }
}

/* Screen reader only */
.ccb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
