/**
 * WCO Data Privacy ohne Bootstrap.
 * Farben, Abstände und Schrift lassen sich über die Custom Properties anpassen, z.B.:
 * :root { --wdp-color-primary: #004b87; }
 */
:root {
    --wdp-color-primary: #1d4ed8;
    --wdp-color-primary-hover: #1e40af;
    --wdp-color-primary-contrast: #fff;
    --wdp-color-secondary: #4b5563;
    --wdp-color-secondary-hover: #374151;
    --wdp-color-secondary-contrast: #fff;
    --wdp-color-success: #15803d;
    --wdp-color-text: #1f2937;
    --wdp-color-text-muted: #4b5563;
    --wdp-color-border: #d1d5db;
    --wdp-color-background: #fff;
    --wdp-color-background-muted: #f3f4f6;
    --wdp-color-focus: #f59e0b;
    --wdp-overlay-opacity: .5;
    --wdp-radius: .375rem;
    --wdp-font-family: inherit;
    --wdp-font-size: 1rem;
    --wdp-z-index: 6000;
}

/* Dialog */
.wdp-cookie-settings__overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s;
}

.wdp-cookie-settings__overlay.shown {
    z-index: calc(var(--wdp-z-index) + 1);
    opacity: var(--wdp-overlay-opacity);
    visibility: visible;
}

.wdp-cookie-settings__wrapper {
    position: fixed;
    inset: 0;
    z-index: calc(var(--wdp-z-index) + 5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    visibility: hidden;
    pointer-events: none;
}

.wdp-cookie-settings__wrapper.shown {
    visibility: visible;
}

.wdp-cookie-settings {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 45rem;
    max-height: 90vh;
    overflow: auto;
    color: var(--wdp-color-text);
    font-family: var(--wdp-font-family);
    font-size: var(--wdp-font-size);
    line-height: 1.5;
    overflow-wrap: break-word;
    hyphens: auto;
    background: var(--wdp-color-background);
    border-radius: var(--wdp-radius);
    box-shadow: 0 .5rem 2rem rgba(0, 0, 0, .3);
    opacity: 0;
    visibility: hidden;
    transform: scale(.9);
    transition: opacity .3s, transform .3s;
}

.wdp-cookie-settings.shown {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    pointer-events: auto;
}

.wdp-cookie-settings:focus {
    outline: none;
}

.wdp-cookie-settings h2,
.wdp-cookie-settings h3 {
    margin: 0 0 .5rem;
    font-weight: 600;
    line-height: 1.3;
}

.wdp-cookie-settings h2 {
    font-size: 1.25em;
}

.wdp-cookie-settings h3 {
    font-size: 1em;
}

.wdp-cookie-settings p {
    margin: 0 0 .5rem;
    color: var(--wdp-color-text-muted);
    font-size: .875em;
}

.wdp-cookie-settings__header {
    position: relative;
    padding: 1.25rem 3.5rem 1rem 1.25rem;
    border-bottom: 1px solid var(--wdp-color-border);
}

.wdp-cookie-settings__header .wdp-close-cookie-settings {
    position: absolute;
    top: .5rem;
    right: .5rem;
}

.wdp-cookie-settings__cookie-types {
    padding: .5rem 1.25rem;
}

.wdp-cookie-settings__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--wdp-color-border);
}

.wdp-cookie-settings__footer-link {
    color: inherit;
    text-decoration: underline;
}

.wdp-cookie-settings__button-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* Akkordeon (native details/summary) */
.wdp-accordion__item {
    border: 1px solid var(--wdp-color-border);
    border-radius: var(--wdp-radius);
}

.wdp-accordion__item + .wdp-accordion__item {
    margin-top: .5rem;
}

.wdp-accordion__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1rem;
    list-style: none;
    cursor: pointer;
    background: var(--wdp-color-background-muted);
    border-radius: var(--wdp-radius);
}

.wdp-accordion__header::-webkit-details-marker {
    display: none;
}

.wdp-accordion__header::after {
    content: "";
    flex-shrink: 0;
    width: .5rem;
    height: .5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .2s;
}

.wdp-accordion__item[open] > .wdp-accordion__header {
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}

.wdp-accordion__item[open] > .wdp-accordion__header::after {
    transform: rotate(-135deg);
}

.wdp-cookie-settings .wdp-accordion__heading {
    margin: 0;
    font-size: 1em;
}

.wdp-accordion__body {
    padding: 0 1rem;
}

/* Cookie-Typen */
.wdp-cookie-settings__cookie-type {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.5rem;
    justify-content: space-between;
    padding: .75rem 0;
}

.wdp-cookie-settings__cookie-type + .wdp-cookie-settings__cookie-type {
    border-top: 1px solid var(--wdp-color-border);
}

.wdp-cookie-settings__cookie-type-description {
    flex: 1 1 20rem;
    min-width: 0;
}

.wdp-cookie-settings__cookie-type-enabler-container,
.wdp-cookie-settings__cookie-type-status-container {
    flex: 0 0 auto;
}

.wdp-cookie-settings__cookie-type-status-label {
    color: var(--wdp-color-text-muted);
    font-size: .875em;
}

.wdp-cookie-settings__cookie-type-status-mandatory {
    display: block;
    font-weight: 600;
}

.wdp-cookie-settings__cookie-type-enabler-container p {
    margin-top: .25rem;
}

.wdp-cookie-state.wdp-cookie-button-standalone {
    margin-bottom: 1rem;
}

/* Schalter (native Checkbox mit role="switch") */
.wdp-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    user-select: none;
}

.wdp-switch__input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}

.wdp-switch__track {
    position: relative;
    flex-shrink: 0;
    width: 2.75rem;
    height: 1.5rem;
    background: var(--wdp-color-border);
    border-radius: 1rem;
    transition: background-color .2s;
}

.wdp-switch__thumb {
    position: absolute;
    top: .1875rem;
    left: .1875rem;
    width: 1.125rem;
    height: 1.125rem;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
    transition: transform .2s;
}

.wdp-switch__input:checked + .wdp-switch__track {
    background: var(--wdp-color-success);
}

.wdp-switch__input:checked + .wdp-switch__track .wdp-switch__thumb {
    transform: translateX(1.25rem);
}

.wdp-switch__input:focus-visible + .wdp-switch__track {
    outline: 3px solid var(--wdp-color-focus);
    outline-offset: 2px;
}

.wdp-switch__label {
    font-size: .875em;
    font-weight: 600;
}

.wdp-switch__input:checked ~ .wdp-switch__label--off,
.wdp-switch__input:not(:checked) ~ .wdp-switch__label--on {
    display: none;
}

/* Buttons */
.wdp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    padding: .5rem 1rem;
    font: inherit;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--wdp-radius);
    transition: background-color .2s, border-color .2s, color .2s;
}

.wdp-btn:focus-visible,
.wco-data-privacy a:focus-visible,
.wdp-accordion__header:focus-visible {
    outline: 3px solid var(--wdp-color-focus);
    outline-offset: 2px;
}

.wdp-btn--primary {
    color: var(--wdp-color-primary-contrast);
    background: var(--wdp-color-primary);
    border-color: var(--wdp-color-primary);
}

.wdp-btn--primary:hover {
    background: var(--wdp-color-primary-hover);
    border-color: var(--wdp-color-primary-hover);
}

.wdp-btn--secondary {
    color: var(--wdp-color-secondary-contrast);
    background: var(--wdp-color-secondary);
    border-color: var(--wdp-color-secondary);
}

.wdp-btn--secondary:hover {
    background: var(--wdp-color-secondary-hover);
    border-color: var(--wdp-color-secondary-hover);
}

.wdp-btn--icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    color: inherit;
    font-size: 1.5rem;
    font-weight: 400;
}

.wdp-btn--icon:hover {
    background: var(--wdp-color-background-muted);
}

/* Hinweise */
.wdp-alert {
    padding: .75rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--wdp-radius);
}

.wdp-alert--warning {
    color: #713f12;
    background: #fef9c3;
    border-color: #fde047;
}

/* Platzhalter für externe Plugins */
.wpdPluginPreview.preview-container {
    position: relative;
    box-sizing: border-box;
    max-width: 100%;
    min-height: 12rem;
    background: var(--wdp-color-background-muted);
    border: 1px solid var(--wdp-color-border);
}

.wpdPluginPreview .wpdPluginPreviewInner {
    width: 100%;
    height: 100%;
}

.wpdPluginPreview .wpdPluginPreviewMessage {
    position: absolute;
    top: 50%;
    left: 0;
    box-sizing: border-box;
    width: 100%;
    padding: 1rem;
    color: #fff;
    text-align: center;
    background: rgba(0, 0, 0, .8);
    transform: translateY(-50%);
}

.wpdPluginPreview .wpdPluginPreviewMessage p {
    margin: 0 0 1rem;
}

.wpdPluginPreview .wpdPluginPreviewMessage a {
    color: inherit;
    text-decoration: underline;
}

@media (max-width: 540px) {
    .wdp-cookie-settings__wrapper {
        align-items: flex-end;
        padding: 0;
    }

    .wdp-cookie-settings {
        max-height: 90vh;
        border-bottom-right-radius: 0;
        border-bottom-left-radius: 0;
    }

    .wdp-cookie-settings__button-wrapper,
    .wdp-cookie-settings__button-wrapper .wdp-cookie-settings__save-button,
    .wdp-cookie-settings__button-wrapper .wdp-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wdp-cookie-settings,
    .wdp-cookie-settings__overlay,
    .wdp-switch__track,
    .wdp-switch__thumb,
    .wdp-accordion__header::after {
        transition: none;
    }
}
