/* Bullish GDPR – Cookie Consent Modal */

/* ── Overlay ── */

#bg-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#bg-overlay.is-visible {
    display: block;
}

/* ── Modal – desktop ── */

#bg-banner {
    display: none;
    position: fixed;
    z-index: 99999;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 10px;
    padding: 28px 28px 20px;
    box-sizing: border-box;

    background: #fff;
    color: #111827;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.1);
}

#bg-banner.is-visible {
    display: block;
}

/* Dark mode */
.dark #bg-banner {
    background: #1f2937;
    color: #f3f4f6;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ── Modal – mobil (bottom sheet) ── */

@media (max-width: 540px) {
    #bg-banner {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        max-height: 88vh;
        border-radius: 18px 18px 0 0;
        padding: 0;
        overflow-y: hidden;
        display: none;          /* bibehåll; .is-visible sätter flex */
        flex-direction: column;
    }

    #bg-banner.is-visible {
        display: flex;
    }

    #bg-banner-scroll {
        flex: 1;
        overflow-y: auto;
        padding: 22px 18px 12px;
        -webkit-overflow-scrolling: touch;
    }

    #bg-banner-bottom {
        padding: 12px 18px 20px;
        border-top: 1px solid #e5e7eb;
        background: #fff;
        flex-shrink: 0;
    }

    .dark #bg-banner-bottom {
        background: #1f2937;
        border-color: #374151;
    }

    /* Dra-handtag längst upp */
    #bg-banner-scroll::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: #d1d5db;
        border-radius: 2px;
        margin: 0 auto 18px;
    }

    .dark #bg-banner-scroll::before {
        background: #4b5563;
    }

    #bg-banner-text {
        margin-bottom: 14px;
    }

    #bg-banner-actions {
        margin-bottom: 10px;
    }
}

/* ── Header ── */

#bg-banner-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

#bg-icon {
    width: 22px;
    height: 22px;
    color: #6b7280;
    flex-shrink: 0;
}

.dark #bg-icon {
    color: #9ca3af;
}

#bg-banner-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    color: #111827;
}

.dark #bg-banner-title {
    color: #f9fafb;
}

/* ── Intro text ── */

#bg-banner-text {
    margin: 0 0 20px;
    font-size: 13px;
    line-height: 1.6;
    color: #4b5563;
}

.dark #bg-banner-text {
    color: #9ca3af;
}

/* ── Categories ── */

#bg-categories {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    overflow: hidden;
}

.dark #bg-categories {
    border-color: #374151;
}

.bg-category {
    padding: 13px 14px;
    background: #f9fafb;
    font-size: 13px;
}

.dark .bg-category {
    background: #111827;
}

.bg-category + .bg-category {
    border-top: 1px solid #e5e7eb;
}

.dark .bg-category + .bg-category {
    border-color: #374151;
}

.bg-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.bg-category-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bg-category-name strong {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.dark .bg-category-name strong {
    color: #f3f4f6;
}

.bg-category-desc {
    margin: 0 0 8px;
    font-size: 12px;
    line-height: 1.55;
    color: #6b7280;
}

.dark .bg-category-desc {
    color: #9ca3af;
}

/* ── Badges ── */

.bg-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1.4;
}

.bg-badge--on {
    background: #dcfce7;
    color: #15803d;
}

.dark .bg-badge--on {
    background: #14532d;
    color: #86efac;
}

.bg-badge--optional {
    background: #f3f4f6;
    color: #6b7280;
}

.dark .bg-badge--optional {
    background: #374151;
    color: #9ca3af;
}

.bg-badge--optional.is-on {
    background: #dcfce7;
    color: #15803d;
}

.dark .bg-badge--optional.is-on {
    background: #14532d;
    color: #86efac;
}

/* ── Toggle switch ── */

.bg-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.bg-toggle--locked {
    cursor: not-allowed;
    opacity: 0.5;
}

.bg-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.bg-toggle-track {
    display: block;
    width: 36px;
    height: 20px;
    background: #d1d5db;
    border-radius: 20px;
    transition: background 0.2s;
    position: relative;
}

.bg-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.bg-toggle--locked .bg-toggle-track {
    background: #6ee7b7;
}

.dark .bg-toggle--locked .bg-toggle-track {
    background: #059669;
}

.bg-toggle input:checked + .bg-toggle-track {
    background: #2563eb;
}

.bg-toggle input:checked + .bg-toggle-track::after {
    transform: translateX(16px);
}

/* ── Cookie list ── */

.bg-cookie-list {
    margin: 6px 0 0;
    padding: 0 0 0 14px;
    list-style: disc;
    font-size: 11.5px;
    line-height: 1.7;
    color: #9ca3af;
}

.dark .bg-cookie-list {
    color: #6b7280;
}

.bg-cookie-name {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 11px;
    color: #4b5563;
}

.dark .bg-cookie-name {
    color: #9ca3af;
}

/* ── Action buttons ── */

#bg-banner-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

#bg-banner-actions button {
    flex: 1 1 auto;
    padding: 9px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

#bg-reject {
    background: transparent;
    color: #6b7280;
    border-color: #d1d5db !important;
}

#bg-reject:hover {
    background: #f3f4f6;
    color: #374151;
}

.dark #bg-reject {
    color: #9ca3af;
    border-color: #4b5563 !important;
}

.dark #bg-reject:hover {
    background: #374151;
    color: #f3f4f6;
}

#bg-accept-selection {
    background: transparent;
    color: #2563eb;
    border-color: #2563eb !important;
}

#bg-accept-selection:hover {
    background: #eff6ff;
}

.dark #bg-accept-selection {
    color: #60a5fa;
    border-color: #3b82f6 !important;
}

.dark #bg-accept-selection:hover {
    background: #1e3a5f;
}

#bg-accept {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb !important;
}

#bg-accept:hover {
    background: #1d4ed8;
}

/* ── Footer note ── */

#bg-banner-footer {
    margin: 0;
    font-size: 11.5px;
    color: #9ca3af;
    line-height: 1.5;
    text-align: center;
}

.dark #bg-banner-footer {
    color: #6b7280;
}

#bg-banner-footer a {
    color: #6b7280;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dark #bg-banner-footer a {
    color: #9ca3af;
}

/* ── Floating cookie button ── */

#bg-footer-link {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9997;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 7px 13px 7px 10px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    transition: box-shadow 0.15s, background 0.15s;
    line-height: 1;
}

#bg-footer-link.is-visible {
    display: flex;
}

#bg-footer-link:hover {
    background: #f9fafb;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

#bg-footer-link svg {
    width: 15px;
    height: 15px;
    color: #6b7280;
    flex-shrink: 0;
}

.dark #bg-footer-link {
    background: #1f2937;
    color: #d1d5db;
    border-color: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.dark #bg-footer-link:hover {
    background: #374151;
}

.dark #bg-footer-link svg {
    color: #9ca3af;
}

/* ── Admin: statistik ── */

.bg-stats { max-width: 700px; }

.bg-stat-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.bg-stat-card {
    flex: 1 1 120px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
}

.bg-stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: #1d2327;
}

.bg-stat-value--green { color: #15803d; }
.bg-stat-value--red   { color: #b32d2e; }

.bg-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #646970;
}

/* Stapeldiagram */

.bg-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 120px;
    padding: 0 0 24px;
    border-bottom: 1px solid #c3c4c7;
    position: relative;
}

.bg-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    height: 100%;
    justify-content: flex-end;
    cursor: default;
}

.bg-bar-stack {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    width: 100%;
    flex: 1;
    justify-content: flex-start;
    gap: 1px;
}

.bg-bar {
    width: 100%;
    min-height: 2px;
    border-radius: 2px 2px 0 0;
    transition: opacity .15s;
}

.bg-bar-col:hover .bg-bar { opacity: .75; }

.bg-bar--green { background: #16a34a; }
.bg-bar--red   { background: #dc2626; }

.bg-bar-date {
    font-size: 9px;
    color: #9ca3af;
    text-align: center;
    line-height: 1;
    position: absolute;
    bottom: 4px;
}

.bg-chart-legend {
    margin-top: 10px;
    font-size: 12px;
    color: #646970;
    display: flex;
    align-items: center;
    gap: 4px;
}

.bg-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.bg-legend-dot--green { background: #16a34a; }
.bg-legend-dot--red   { background: #dc2626; }

/* Shortcode-länk */
a.bg-open-banner {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
