/* Paragraph spacing */
#matomo-opt-out p {
    @apply pb-2 lg:pb-4;
}

/* Hide native checkbox */
#matomo-opt-out input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Label as flex container */
#matomo-opt-out label {
    display: flex;
    align-items: center;
    padding-left: calc(1.3125rem + 0.5rem);
    margin-bottom: 0.9375rem;
    cursor: pointer;
    position: relative;
    width: fit-content;
}

/* Custom checkbox box via ::before */
#matomo-opt-out label::before {
    content: "";
    position: absolute;
    left: 0;
    width: 1.3125rem;
    height: 1.3125rem;
    border: 2px solid rgba(0, 0, 0, 0.4);
    border-radius: 0.25rem;
    background-color: white;
    transition: all 100ms ease-in-out;
    z-index: 0;
}

/* Checkmark SVG via ::after with increased size and hardcoded white stroke */
#matomo-opt-out label::after {
    content: "";
    position: absolute;
    left: 0;
    width: 1.3125rem;
    height: 1.3125rem;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2020%2020'%3E%3Cpath%20stroke='white'%20fill='none'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='3'%20d='m6%2010%203%203%206-6'/%3E%3C/svg%3E");
    background-size: 90% auto;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 150ms ease-in-out;
    z-index: 1;
}

/* Hover state */
#matomo-opt-out label:hover::before {
    border-color: var(--brand-teal, #004f59);
}

/* Focus state */
#matomo-opt-out input[type="checkbox"]:focus + label::before {
    outline: 4px solid var(--brand-teal-outline, #7aa2a7);
}

/* Checked state: update checkbox box and show checkmark */
#matomo-opt-out input[type="checkbox"]:checked + label::before {
    background-color: var(--brand-teal, #004f59);
    border-color: rgba(0, 0, 0, 0.4);
}
#matomo-opt-out input[type="checkbox"]:checked + label::after {
    opacity: 1;
}
