/**
 * BSC Suite – Cookie-Banner Styles
 * Apple-Style, WCAG 2.1 AA kompatibel
 */

:root {
    --bsc-color-primary: #007AFF;
    --bsc-color-secondary: #8E8E93;
    --bsc-color-bg: #FFFFFF;
    --bsc-color-text: #1D1D1F;
}

/* ── Overlay ──────────────────────────────────────────── */
.bsc-cookie-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: bscFadeIn 300ms ease-out forwards;
    padding: 16px;
}

.bsc-cookie-overlay[data-position="bottom"] {
    align-items: flex-end;
    padding: 0;
}

@keyframes bscFadeIn {
    to { opacity: 1; }
}

/* ── Banner Container ─────────────────────────────────── */
.bsc-cookie-banner {
    background: var(--bsc-color-bg);
    color: var(--bsc-color-text);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15), 0 8px 20px rgba(0, 0, 0, 0.1);
    max-width: 520px;
    width: 100%;
    padding: 32px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    transform: translateY(20px);
    animation: bscSlideUp 400ms cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

/* Bottom-Position: Volle Breite, von unten hereingleitend */
.bsc-cookie-overlay[data-position="bottom"] .bsc-cookie-banner {
    max-width: 100%;
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 24px 32px 28px;
    margin: 0;
    transform: translateY(100%);
    animation: bscSlideFromBottom 400ms cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes bscSlideUp {
    to { transform: translateY(0); }
}

@keyframes bscSlideFromBottom {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* ── Typography ───────────────────────────────────────── */
.bsc-cookie-title {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin: 0 0 8px;
    color: var(--bsc-color-text);
}

.bsc-cookie-text {
    font-size: 15px;
    line-height: 1.6;
    color: #86868B;
    margin: 0 0 24px;
}

/* ── Category Toggles ─────────────────────────────────── */
.bsc-cookie-categories {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.bsc-cookie-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #F5F5F7;
    border-radius: 12px;
    transition: background 200ms ease;
}

.bsc-cookie-category:hover {
    background: #EDEDF0;
}

.bsc-cookie-cat-info {
    flex: 1;
    min-width: 0;
}

.bsc-cookie-cat-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--bsc-color-text);
}

.bsc-cookie-cat-desc {
    font-size: 12px;
    color: #86868B;
    margin-top: 2px;
}

.bsc-cookie-cat-required {
    font-size: 11px;
    color: #34C759;
    font-weight: 500;
}

/* Toggle Switch */
.bsc-cookie-toggle {
    position: relative;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
    margin-left: 12px;
}

.bsc-cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.bsc-cookie-toggle-track {
    position: absolute;
    inset: 0;
    background: #E5E5EA;
    border-radius: 26px;
    cursor: pointer;
    transition: background 200ms ease;
}

.bsc-cookie-toggle-track::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 2px;
    top: 2px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 200ms ease;
}

.bsc-cookie-toggle input:checked + .bsc-cookie-toggle-track {
    background: var(--bsc-color-primary);
}

.bsc-cookie-toggle input:checked + .bsc-cookie-toggle-track::before {
    transform: translateX(18px);
}

.bsc-cookie-toggle input:disabled + .bsc-cookie-toggle-track {
    background: #34C759;
    opacity: 0.7;
    cursor: default;
}

.bsc-cookie-toggle input:disabled:checked + .bsc-cookie-toggle-track::before {
    transform: translateX(18px);
}

/* ── Buttons ──────────────────────────────────────────── */
.bsc-cookie-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bsc-cookie-btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms ease;
    text-align: center;
    line-height: 1.2;
    -webkit-font-smoothing: antialiased;
}

.bsc-cookie-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.3);
}

.bsc-cookie-btn-accept {
    background: var(--bsc-color-primary);
    color: white;
}

.bsc-cookie-btn-accept:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.bsc-cookie-btn-save {
    background: #F5F5F7;
    color: var(--bsc-color-text);
}

.bsc-cookie-btn-save:hover {
    background: #EDEDF0;
}

.bsc-cookie-btn-decline {
    background: transparent;
    color: #86868B;
    font-weight: 500;
    font-size: 14px;
    padding: 10px;
}

.bsc-cookie-btn-decline:hover {
    color: var(--bsc-color-text);
}

/* ── Links (Datenschutz / Impressum) ──────────────────── */
.bsc-cookie-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #F2F2F7;
}

.bsc-cookie-links a {
    font-size: 12px;
    color: #86868B;
    text-decoration: none;
    transition: color 200ms ease;
}

.bsc-cookie-links a:hover {
    color: var(--bsc-color-primary);
}

/* ── Second Layer (Details) ───────────────────────────── */
.bsc-cookie-details {
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease, opacity 200ms ease;
    opacity: 0;
}

.bsc-cookie-details.open {
    display: block;
    max-height: 400px;
    overflow-y: auto;
    opacity: 1;
    margin-bottom: 16px;
    padding: 12px 0;
    border-top: 1px solid #F2F2F7;
    border-bottom: 1px solid #F2F2F7;
}

.bsc-cookie-details-content {
    padding: 0;
}

.bsc-cookie-details-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--bsc-color-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 8px;
}

.bsc-cookie-details-toggle:hover {
    text-decoration: underline;
}

.bsc-cookie-details-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
    border-radius: 4px;
}

/* ── Elementor Placeholder ────────────────────────────── */
.bsc-elementor-placeholder {
    background: #F5F5F7;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

.bsc-elementor-placeholder p {
    color: #86868B;
    font-size: 14px;
    margin: 0 0 16px;
}

.bsc-elementor-placeholder button {
    background: var(--bsc-color-primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 200ms ease;
}

.bsc-elementor-placeholder button:hover {
    filter: brightness(0.9);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 480px) {
    .bsc-cookie-banner {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .bsc-cookie-title {
        font-size: 20px;
    }

    .bsc-cookie-text {
        font-size: 14px;
    }

    .bsc-cookie-category {
        padding: 10px 12px;
    }
}

/* ── Accessibility ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .bsc-cookie-overlay,
    .bsc-cookie-banner {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .bsc-cookie-toggle-track::before,
    .bsc-cookie-btn {
        transition: none;
    }
}

@media (prefers-contrast: high) {
    .bsc-cookie-banner {
        border: 2px solid var(--bsc-color-text);
    }

    .bsc-cookie-category {
        border: 1px solid #C7C7CC;
    }

    .bsc-cookie-btn-save {
        border: 1px solid #C7C7CC;
    }
}
