/**
 * @package     NVSP.Plugin
 * @subpackage  System.CookieConsent.Media
 * @author      D. Feijtel
 * @copyright   Copyright (C) 2026 D. Feijtel. All rights reserved.
 * @license     GNU General Public License version 2 or later
 * @version     2.2.4
 *
 * NVSP Cookie Consent — banner en modal styling.
 *
 * NVSP huisstijl:
 *   Achtergrond:     #fefefe
 *   Primaire knop:   #0000CD achtergrond, #fefefe tekst  (contrast 8.59:1 ✓)
 *   Secundaire knop: transparant, #2C2E36 rand/tekst     (contrast 14:1 ✓)
 *   Tertiaire knop:  transparant, #0000CD rand/tekst     (contrast 8.59:1 ✓)
 *   Ghost knop:      transparant, geen rand, #2C2E36 tekst underline
 *   Accent groen:    #006400 — uitsluitend voor badges, border-top, FAB, disabled toggle
 *   Tekst:           #2C2E36
 *   Focus outline:   #0000CD
 *
 * Font:          font-family: inherit (Roboto Slab via Astroid — nooit hardcoden)
 * Minimumtekst:  1rem (16px)
 * Regelafstand:  minimaal 1.5
 * WCAG 2.1 AA:   alle combinaties ≥ 4.5:1 ✓
 *
 * position:fixed — vw/vh gebruikt (GEEN %) vanwege Astroid CSS transform.
 * BEM: .nvsp-cc-[blok]__[element] .nvsp-cc-[blok]--[modifier]
 */

/* ================================================================
   Screen-reader utility
   ================================================================ */
.nvsp-cc-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;
}

/* ================================================================
   Banner
   ================================================================ */
.nvsp-cc-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    z-index: 9990;
    background-color: #fefefe;
    color: #2C2E36;
    border-top: 4px solid #006400;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
}

.nvsp-cc-banner[hidden] {
    display: none;
}

.nvsp-cc-banner__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
}

.nvsp-cc-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nvsp-cc-buttons {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.nvsp-cc-banner__text {
    flex: 1 1 300px;
}

.nvsp-cc-banner__title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #2C2E36;
    margin-bottom: 0.25rem;
}

.nvsp-cc-banner__body {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: #2C2E36;
}

.nvsp-cc-banner__link {
    color: #0000CD;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.nvsp-cc-banner__link:hover,
.nvsp-cc-banner__link:focus {
    color: #0000a8;
    text-decoration: none;
}

.nvsp-cc-banner__link:focus-visible {
    outline: 2px solid #0000CD;
    outline-offset: 2px;
    border-radius: 2px;
}

.nvsp-cc-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* ================================================================
   Knoppen — basis
   ================================================================ */
.nvsp-cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.nvsp-cc-btn:focus-visible {
    outline: 3px solid #0000CD;
    outline-offset: 3px;
}

/* Primair: blauw (#0000CD) */
.nvsp-cc-btn--primary {
    background-color: #0000CD;
    color: #fefefe;
    border-color: #0000CD;
}

.nvsp-cc-btn--primary:hover {
    background-color: #0000a8;
    border-color: #0000a8;
    color: #fefefe;
}

/* Secundair: transparant met donkere rand (#2C2E36) */
.nvsp-cc-btn--secondary {
    background-color: transparent;
    color: #2C2E36;
    border-color: #2C2E36;
}

.nvsp-cc-btn--secondary:hover {
    background-color: rgba(44, 46, 54, 0.08);
    color: #2C2E36;
}

/* Tertiair: transparant met blauwe rand (#0000CD) */
.nvsp-cc-btn--tertiary {
    background-color: transparent;
    color: #0000CD;
    border-color: #0000CD;
}

.nvsp-cc-btn--tertiary:hover {
    background-color: rgba(0, 0, 205, 0.08);
    color: #0000a8;
    border-color: #0000a8;
}

/* Ghost: geen rand, onderstreepte tekst */
.nvsp-cc-btn--ghost {
    background-color: transparent;
    color: #2C2E36;
    border-color: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.nvsp-cc-btn--ghost:hover {
    color: #0000CD;
    text-decoration: none;
}

/* Link-stijl: voor "Zelf instellen →" in banner */
.nvsp-cc-btn--link {
    background-color: transparent;
    color: #0000CD;
    border-color: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.nvsp-cc-btn--link:hover {
    color: #0000a8;
    text-decoration: none;
}

.nvsp-cc-btn--link:focus-visible {
    outline-color: #0000CD;
}

/* ================================================================
   Banner knoppen — AP gelijkwaardigheid (alle vier identiek gestyled)
   ================================================================ */
.nvsp-cc-btn-accept,
.nvsp-cc-btn-necessary,
.nvsp-cc-btn-custom,
.nvsp-cc-btn-reject {
    background-color: transparent;
    border-color: #2C2E36;
    color: #2C2E36;
}

.nvsp-cc-btn-accept:hover,
.nvsp-cc-btn-necessary:hover,
.nvsp-cc-btn-custom:hover,
.nvsp-cc-btn-reject:hover {
    background-color: rgba(44, 46, 54, 0.08);
    border-color: #2C2E36;
    color: #2C2E36;
}

.nvsp-cc-btn-accept:focus-visible,
.nvsp-cc-btn-necessary:focus-visible,
.nvsp-cc-btn-custom:focus-visible,
.nvsp-cc-btn-reject:focus-visible {
    outline: 3px solid #0000CD;
    outline-offset: 3px;
}

/* ================================================================
   Overlay (donkere laag achter modal)
   ================================================================ */
.nvsp-cc-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9991;
    display: none;
}

.nvsp-cc-overlay:not([hidden]) {
    display: block;
}

/* ================================================================
   Modal
   ================================================================ */
.nvsp-cc-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9992;
    width: calc(100vw - 2rem);
    max-width: 680px;
    max-height: 90vh;
    background-color: #fefefe;
    color: #2C2E36;
    border-top: 4px solid #006400;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
    display: flex;
    flex-direction: column;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    box-sizing: border-box;
}

.nvsp-cc-modal[hidden] {
    display: none;
}

.nvsp-cc-modal__inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.nvsp-cc-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.nvsp-cc-modal__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    color: #2C2E36;
    font-family: inherit;
}

.nvsp-cc-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: none;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.5rem;
    color: #2C2E36;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.nvsp-cc-modal__close:hover {
    background-color: rgba(44, 46, 54, 0.08);
}

.nvsp-cc-modal__close:focus-visible {
    outline: 3px solid #0000CD;
    outline-offset: 2px;
}

.nvsp-cc-modal__body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 1.5rem;
    flex: 1 1 auto;
    min-height: 0;
    scroll-behavior: smooth;
}

.nvsp-cc-modal__body::-webkit-scrollbar {
    width: 6px;
}

.nvsp-cc-modal__body::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.nvsp-cc-modal__body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.nvsp-cc-modal__intro {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #2C2E36;
}

.nvsp-cc-modal__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    align-items: center;
}

/* Detail-sectie: verborgen totdat "Zelf instellen" geklikt wordt */
#nvsp-cc-detail-section[hidden] {
    display: none;
}

/* ================================================================
   Categorieën (in modal)
   ================================================================ */
.nvsp-cc-category {
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.nvsp-cc-category:last-child {
    border-bottom: none;
}

.nvsp-cc-category__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nvsp-cc-category__name {
    font-weight: 600;
    font-size: 1rem;
    color: #2C2E36;
    flex: 1 1 auto;
}

.nvsp-cc-category__badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fefefe;
    background-color: #006400;
    padding: 0.125rem 0.5rem;
    border-radius: 20px;
    white-space: nowrap;
}

.nvsp-cc-category__details {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    color: #4b5563;
}

.nvsp-cc-category__details summary {
    cursor: pointer;
    font-weight: 500;
    color: #0000CD;
    font-size: 0.9375rem;
    user-select: none;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.nvsp-cc-category__details summary::-webkit-details-marker {
    display: none;
}

.nvsp-cc-category__details summary::before {
    content: '\25B6';
    font-size: 0.75em;
    transition: transform 0.15s ease;
    display: inline-block;
}

.nvsp-cc-category__details[open] summary::before {
    transform: rotate(90deg);
}

.nvsp-cc-category__details summary:focus-visible {
    outline: 2px solid #0000CD;
    outline-offset: 2px;
    border-radius: 2px;
}

.nvsp-cc-category__details p {
    margin: 0.5rem 0 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #4b5563;
}

/* ================================================================
   Toggle switch
   ================================================================ */
.nvsp-cc-toggle {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.75rem;
    flex-shrink: 0;
    cursor: pointer;
}

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

.nvsp-cc-toggle__slider {
    position: absolute;
    inset: 0;
    background-color: #d1d5db;
    border-radius: 1.75rem;
    transition: background-color 0.2s ease;
}

.nvsp-cc-toggle__slider::before {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    left: 0.25rem;
    bottom: 0.25rem;
    background-color: #fefefe;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.nvsp-cc-toggle input:checked + .nvsp-cc-toggle__slider {
    background-color: #0000CD;
}

.nvsp-cc-toggle input:checked + .nvsp-cc-toggle__slider::before {
    transform: translateX(1.25rem);
}

.nvsp-cc-toggle:focus-within .nvsp-cc-toggle__slider {
    outline: 3px solid #0000CD;
    outline-offset: 2px;
}

.nvsp-cc-toggle--disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.nvsp-cc-toggle--disabled .nvsp-cc-toggle__slider,
.nvsp-cc-toggle--disabled input:checked + .nvsp-cc-toggle__slider {
    background-color: #006400;
}

/* ================================================================
   FAB
   ================================================================ */
.nvsp-cc-fab {
    position: fixed;
    bottom: 125px;
    left: 14px;
    right: auto;
    z-index: 9989;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: #006400;
    color: #fefefe;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.nvsp-cc-fab:hover {
    background-color: #004d00;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.nvsp-cc-fab:focus-visible {
    outline: 3px solid #0000CD;
    outline-offset: 3px;
}

.nvsp-cc-wrapper:has(#nvsp-cc-banner:not([hidden])) ~ .nvsp-cc-fab {
    display: none;
}

/* ================================================================
   Banner overlay (bij modal-positiemodus)
   ================================================================ */
.nvsp-cc-banner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9988;
}

.nvsp-cc-wrapper[data-nvsp-cc-position="modal"] #nvsp-cc-banner:not([hidden]) ~ .nvsp-cc-banner-overlay {
    display: block;
}

/* ================================================================
   Bannerpositie — varianten
   ================================================================ */
.nvsp-cc-wrapper[data-nvsp-cc-position="top_bar"] .nvsp-cc-banner {
    bottom: auto;
    top: 0;
    border-top: none;
    border-bottom: 4px solid #006400;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
}

.nvsp-cc-wrapper[data-nvsp-cc-position="bottom_left"] .nvsp-cc-banner {
    left: 1.5rem;
    bottom: 1.5rem;
    width: auto;
    max-width: 420px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}

.nvsp-cc-wrapper[data-nvsp-cc-position="bottom_left"] .nvsp-cc-banner__inner {
    flex-direction: column;
    align-items: flex-start;
}

.nvsp-cc-wrapper[data-nvsp-cc-position="bottom_right"] .nvsp-cc-banner {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
    width: auto;
    max-width: 420px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}

.nvsp-cc-wrapper[data-nvsp-cc-position="bottom_right"] .nvsp-cc-banner__inner {
    flex-direction: column;
    align-items: flex-start;
}

.nvsp-cc-wrapper[data-nvsp-cc-position="modal"] .nvsp-cc-banner {
    top: 50%;
    left: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: calc(100vw - 2rem);
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
    z-index: 9990;
}

.nvsp-cc-wrapper[data-nvsp-cc-position="modal"] .nvsp-cc-banner__inner {
    flex-direction: column;
    align-items: flex-start;
}

/* ================================================================
   Bannerpositie — class-gebaseerde varianten (v2.1.1)
   ================================================================ */

/* bottom: standaard onderbalk — base .nvsp-cc-banner is al correct */

/* center: gecentreerde banner met overlay */
.nvsp-cc-wrap.nvsp-consent--center .nvsp-cc-banner {
    top: 50%;
    left: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: calc(100vw - 2rem);
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
    z-index: 9990;
}

.nvsp-cc-wrap.nvsp-consent--center .nvsp-cc-banner__inner {
    flex-direction: column;
    align-items: flex-start;
}

.nvsp-cc-wrap.nvsp-consent--center #nvsp-cc-banner:not([hidden]) ~ #nvsp-cc-banner-overlay {
    display: block;
}

/* top-full: bovenbalk, volledige breedte */
.nvsp-cc-wrap.nvsp-consent--top-full .nvsp-cc-banner {
    top: 0;
    left: 0;
    bottom: auto;
    width: 100vw;
    border-radius: 0;
    border-top: none;
    border-bottom: 4px solid #006400;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
}

/* bottom-left: linksonder, compact */
.nvsp-cc-wrap.nvsp-consent--bottom-left .nvsp-cc-banner {
    left: 24px;
    bottom: 24px;
    width: auto;
    max-width: 480px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}

.nvsp-cc-wrap.nvsp-consent--bottom-left .nvsp-cc-banner__inner {
    flex-direction: column;
    align-items: flex-start;
}

/* bottom-right: rechtsonder, compact */
.nvsp-cc-wrap.nvsp-consent--bottom-right .nvsp-cc-banner {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: auto;
    max-width: 480px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}

.nvsp-cc-wrap.nvsp-consent--bottom-right .nvsp-cc-banner__inner {
    flex-direction: column;
    align-items: flex-start;
}

/* ================================================================
   Links container
   ================================================================ */
.nvsp-consent__links {
    margin-top: 16px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.nvsp-consent__links a {
    color: inherit;
    text-decoration: underline;
    font-size: 14px;
}

/* ================================================================
   Responsive — ≤580px
   ================================================================ */
@media (max-width: 580px) {
    .nvsp-cc-banner__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .nvsp-cc-banner__actions {
        width: 100%;
        flex-direction: column;
    }

    .nvsp-cc-banner__actions .nvsp-cc-btn {
        width: 100%;
        justify-content: center;
    }

    .nvsp-cc-modal {
        top: auto;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100vw;
        max-width: 100vw;
        max-height: 85vh;
        border-radius: 12px 12px 0 0;
    }

    .nvsp-cc-modal__header {
        padding: 1rem 1.25rem 0.75rem;
    }

    .nvsp-cc-modal__body {
        padding: 0.75rem 1rem;
    }

    .nvsp-cc-modal__footer {
        padding: 0.75rem 1rem 1rem;
        flex-direction: column;
    }

    .nvsp-cc-modal__footer .nvsp-cc-btn {
        width: 100%;
        justify-content: center;
    }

    .nvsp-cc-wrapper[data-nvsp-cc-position="bottom_left"] .nvsp-cc-banner,
    .nvsp-cc-wrapper[data-nvsp-cc-position="bottom_right"] .nvsp-cc-banner {
        left: 0;
        right: 0;
        bottom: 0;
        max-width: 100vw;
        border-radius: 0;
    }

    .nvsp-cc-wrapper[data-nvsp-cc-position="modal"] .nvsp-cc-banner {
        top: auto;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100vw;
        max-width: 100vw;
        border-radius: 12px 12px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nvsp-cc-toggle__slider,
    .nvsp-cc-toggle__slider::before,
    .nvsp-cc-btn,
    .nvsp-cc-fab {
        transition: none;
    }

    .nvsp-cc-category__details summary::before {
        transition: none;
    }
}
