/* dxw3 Consent
 * Colours and shapes are custom properties; override them in the theme, e.g.
 * .dxw3-consent { --dxw3-accent: #0b5cad; --dxw3-radius: 4px; }
 */

.dxw3-consent {
    --dxw3-font: inherit;
    --dxw3-bg: #ffffff;
    --dxw3-text: #1f2328;
    --dxw3-muted: #59636e;
    --dxw3-border: #d8dee4;
    --dxw3-accent: #1f2328;
    --dxw3-accent-text: #ffffff;
    --dxw3-accent-hover: #3d444d;
    --dxw3-switch-on: #0b5cad;
    --dxw3-focus: #0b5cad;
    --dxw3-radius: 12px;
    --dxw3-btn-radius: 8px;
    --dxw3-shadow: 0 12px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
    --dxw3-z: 100000;

    font-family: var(--dxw3-font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--dxw3-text);
}

.dxw3-consent *,
.dxw3-consent *::before,
.dxw3-consent *::after {
    box-sizing: border-box;
}

/* --- Shared text ------------------------------------------------------------ */

.dxw3-consent h2.dxw3-banner__title,
.dxw3-consent h2.dxw3-modal__title {
    font-family: var(--dxw3-font);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: normal;
    text-transform: none;
    color: var(--dxw3-text);
    margin: 0 0 6px;
    padding: 0;
}

.dxw3-consent p {
    font-family: var(--dxw3-font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--dxw3-muted);
    margin: 0;
}

.dxw3-consent .dxw3-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin-top: 10px;
}

.dxw3-consent .dxw3-links a {
    font-size: 14px;
    color: var(--dxw3-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dxw3-consent .dxw3-links a:hover {
    text-decoration: none;
}

/* --- Buttons ---------------------------------------------------------------- */

.dxw3-consent button.dxw3-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 0;
    width: auto;
    margin: 0;
    padding: 10px 20px;
    border-radius: var(--dxw3-btn-radius);
    border: 1px solid var(--dxw3-accent);
    font-family: var(--dxw3-font);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.dxw3-consent button.dxw3-btn--primary {
    background: var(--dxw3-accent);
    color: var(--dxw3-accent-text);
}

.dxw3-consent button.dxw3-btn--primary:hover {
    background: var(--dxw3-accent-hover);
    border-color: var(--dxw3-accent-hover);
    color: var(--dxw3-accent-text);
}

.dxw3-consent button.dxw3-btn--ghost {
    background: transparent;
    color: var(--dxw3-text);
    border-color: var(--dxw3-border);
}

.dxw3-consent button.dxw3-btn--ghost:hover {
    background: rgba(15, 23, 42, 0.05);
    border-color: var(--dxw3-muted);
    color: var(--dxw3-text);
}

.dxw3-consent button:focus {
    outline: none;
}

.dxw3-consent button:focus-visible,
.dxw3-consent a:focus-visible,
.dxw3-consent [tabindex="-1"]:focus-visible {
    outline: 3px solid var(--dxw3-focus);
    outline-offset: 2px;
}

/* --- Banner ----------------------------------------------------------------- */

.dxw3-consent .dxw3-banner {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: var(--dxw3-z);
    width: calc(100% - 32px);
    max-width: 1040px;
    display: none;
    background: var(--dxw3-bg);
    border: 1px solid var(--dxw3-border);
    border-radius: var(--dxw3-radius);
    box-shadow: var(--dxw3-shadow);
    padding: 20px 24px;
    text-align: left;
}

.dxw3-consent .dxw3-banner.active {
    display: flex !important;
    align-items: center;
    gap: 24px;
}

.dxw3-consent .dxw3-banner__content {
    flex: 1 1 auto;
    min-width: 0;
}

.dxw3-consent .dxw3-banner__actions {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* --- Modal ------------------------------------------------------------------ */

.dxw3-consent .dxw3-overlay {
    position: fixed;
    inset: 0;
    z-index: calc(var(--dxw3-z) + 1);
    background: rgba(15, 23, 42, 0.45);
}

html.dxw3-modal-open {
    overflow: hidden;
}

.dxw3-consent .dxw3-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: calc(var(--dxw3-z) + 2);
    width: calc(100% - 32px);
    max-width: 560px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    flex-direction: column;
    background: var(--dxw3-bg);
    border-radius: var(--dxw3-radius);
    box-shadow: var(--dxw3-shadow);
    overflow: hidden;
}

.dxw3-consent .dxw3-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 12px 24px;
    border-bottom: 1px solid var(--dxw3-border);
}

.dxw3-consent h2.dxw3-modal__title {
    margin: 0;
}

/* The title only receives programmatic focus when the dialog opens. */
.dxw3-consent h2.dxw3-modal__title:focus {
    outline: none;
}

.dxw3-consent button.dxw3-modal__close,
.dxw3-consent button.dxw3-toast__close {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--dxw3-muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
}

.dxw3-consent button.dxw3-modal__close:hover,
.dxw3-consent button.dxw3-toast__close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--dxw3-text);
}

.dxw3-consent .dxw3-modal__body {
    padding: 16px 24px 8px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
}

.dxw3-consent ul.dxw3-categories {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
}

.dxw3-consent li.dxw3-category {
    margin: 0;
    padding: 14px 0;
    border-top: 1px solid var(--dxw3-border);
    list-style: none;
}

.dxw3-consent li.dxw3-category:first-child {
    border-top: 0;
    padding-top: 4px;
}

.dxw3-consent .dxw3-category__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.dxw3-consent .dxw3-category__label {
    font-size: 15px;
    font-weight: 600;
    color: var(--dxw3-text);
}

.dxw3-consent .dxw3-category__desc {
    font-size: 14px;
    line-height: 1.45;
    color: var(--dxw3-muted);
}

.dxw3-consent .dxw3-modal__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 24px 6px;
    border-top: 1px solid var(--dxw3-border);
}

.dxw3-consent .design-by {
    text-align: right;
    font-size: 9px;
    color: var(--dxw3-muted);
    opacity: 0.6;
    padding: 2px 24px 8px;
}

/* --- Switch ------------------------------------------------------------------ */

.dxw3-consent label.dxw3-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0;
    width: 100%;
    cursor: pointer;
    font-weight: normal;
}

.dxw3-consent .dxw3-switch input {
    position: absolute;
    opacity: 0;
    width: 44px;
    height: 24px;
    right: 0;
    margin: 0;
    cursor: pointer;
}

.dxw3-consent .dxw3-slider {
    position: relative;
    flex: 0 0 auto;
    display: inline-block;
    width: 44px;
    height: 24px;
    background-color: #b6bec8;
    border-radius: 999px;
    transition: background-color 0.2s ease;
}

.dxw3-consent .dxw3-slider::before {
    position: absolute;
    content: "";
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.dxw3-consent .dxw3-switch input:checked + .dxw3-slider {
    background-color: var(--dxw3-switch-on);
}

.dxw3-consent .dxw3-switch input:checked + .dxw3-slider::before {
    transform: translateX(20px);
}

.dxw3-consent .dxw3-switch input:disabled + .dxw3-slider {
    opacity: 0.55;
}

.dxw3-consent .dxw3-switch input:disabled {
    cursor: not-allowed;
}

.dxw3-consent .dxw3-switch input:focus-visible + .dxw3-slider {
    outline: 3px solid var(--dxw3-focus);
    outline-offset: 2px;
}

/* --- "Not saved" notice ----------------------------------------------------- */

.dxw3-consent .dxw3-toast {
    position: fixed;
    left: 50%;
    top: 16px;
    transform: translateX(-50%);
    z-index: calc(var(--dxw3-z) + 3);
    width: calc(100% - 32px);
    max-width: 560px;
    background: #fff8e1;
    color: #5c4400;
    border: 1px solid #f0d27a;
    border-radius: var(--dxw3-btn-radius);
    box-shadow: var(--dxw3-shadow);
    padding: 10px 8px 10px 16px;
    font-size: 14px;
}

.dxw3-consent .dxw3-toast.active {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.dxw3-consent .dxw3-toast span {
    flex: 1 1 auto;
}

/* --- Reopen icon ------------------------------------------------------------- */

.dxw3-consent button.cookie-button {
    position: fixed;
    bottom: 8px;
    left: 8px;
    z-index: calc(var(--dxw3-z) - 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 0;
    padding: 4px;
    margin: 0;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: none;
    animation: dxw3-bounce 5s infinite ease-in-out;
}

.dxw3-consent button.cookie-button img {
    display: block;
    width: 30px;
    height: 30px;
}

.dxw3-consent button.cookie-button:hover {
    background-color: transparent;
    animation: dxw3-pulse 2s infinite ease-in-out;
}

.dxw3-consent .dxw3-banner.active ~ .cookie-button,
.dxw3-consent .dxw3-modal.active ~ .cookie-button {
    display: none;
}

.dxw3-consent .consent-icon-none,
.dxw3-consent button.cookie-button.consent-icon-none {
    display: none;
}

/* --- Footer link bar --------------------------------------------------------- */

.dxw3-footer-bar {
    background: black;
    text-align: center;
    padding: 4px 0;
    font-size: 12px;
}

.dxw3-footer-bar a {
    color: #C0C0C0;
    text-decoration: none;
    font-weight: bold;
}

.dxw3-footer-bar a:hover {
    color: white;
}

.dxw3-footer-bar a:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* --- Fading ------------------------------------------------------------------ */

.dxw3-consent .dxw3-banner,
.dxw3-consent .dxw3-modal,
.dxw3-consent .dxw3-overlay,
.dxw3-consent .dxw3-toast {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.dxw3-consent .dxw3-banner.active,
.dxw3-consent .dxw3-modal.active,
.dxw3-consent .dxw3-overlay.active,
.dxw3-consent .dxw3-toast.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s;
}

@keyframes dxw3-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

@keyframes dxw3-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* --- Responsive ------------------------------------------------------------- */

@media (max-width: 860px) {
    .dxw3-consent .dxw3-banner.active {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .dxw3-consent .dxw3-banner__actions {
        justify-content: stretch;
    }

    .dxw3-consent .dxw3-banner__actions .dxw3-btn {
        flex: 1 1 0;
    }
}

@media (max-width: 600px) {
    .dxw3-consent .dxw3-banner {
        left: 0;
        bottom: 0;
        transform: none;
        width: 100%;
        max-height: 85vh;
        max-height: 85dvh;
        overflow-y: auto;
        border-radius: var(--dxw3-radius) var(--dxw3-radius) 0 0;
        border-width: 1px 0 0;
        padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .dxw3-consent .dxw3-banner__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .dxw3-consent .dxw3-banner__actions .open-cookie-settings {
        grid-column: 1 / -1;
        order: 3;
    }

    .dxw3-consent .dxw3-modal {
        left: 0;
        top: auto;
        bottom: 0;
        transform: none;
        width: 100%;
        max-width: none;
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: var(--dxw3-radius) var(--dxw3-radius) 0 0;
    }

    .dxw3-consent .dxw3-modal__header,
    .dxw3-consent .dxw3-modal__body,
    .dxw3-consent .dxw3-modal__footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .dxw3-consent .dxw3-modal__footer {
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    }

    .dxw3-consent .dxw3-modal__footer .save-cookie-settings {
        grid-column: 1 / -1;
        order: 3;
    }

    .dxw3-consent button.dxw3-btn {
        white-space: normal;
        padding: 10px 12px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .dxw3-consent .dxw3-banner {
        max-height: calc(100vh - 16px);
        overflow-y: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dxw3-consent .dxw3-banner,
    .dxw3-consent .dxw3-modal,
    .dxw3-consent .dxw3-overlay,
    .dxw3-consent .dxw3-toast {
        transition: none;
    }

    .dxw3-consent button.cookie-button,
    .dxw3-consent button.cookie-button:hover {
        animation: none;
    }
}
