/**
 * Dobry Kartacz – Global Form Styles
 * Custom checkbox appearance & file-input button styling.
 * Based on: https://moderncss.dev/pure-css-custom-checkbox-style/
 */

/* ── CSS Variables ── */
:root {
    --form-control-color: #fb471f;
    --form-control-disabled: #959495;
}

/* ── Checkbox: full reset & custom style ──
 * !important overrides Divi / WooCommerce theme defaults
 */
input[type="checkbox"],
.woocommerce input[type="checkbox"],
.et-db #et-boc input[type="checkbox"],
#ship-to-different-address input[type="checkbox"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    background-color: var(--form-background, #fff) !important;
    background-image: none !important;
    margin: 0 !important;
    font: inherit;
    color: currentColor;
    width: 1.15em !important;
    height: 1.15em !important;
    min-width: 1.15em;
    min-height: 1.15em;
    border: 0.15em solid currentColor !important;
    border-radius: 0.15em !important;
    transform: translateY(-0.075em);
    display: grid !important;
    place-content: center;
    cursor: pointer;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

input[type="checkbox"]::before,
.woocommerce input[type="checkbox"]::before,
.et-db #et-boc input[type="checkbox"]::before {
    content: "" !important;
    width: 0.65em !important;
    height: 0.65em !important;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
    transform: scale(0);
    transform-origin: bottom left;
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em var(--form-control-color) !important;
    background-color: CanvasText;
    background-image: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

input[type="checkbox"]:checked::before,
.woocommerce input[type="checkbox"]:checked::before,
.et-db #et-boc input[type="checkbox"]:checked::before {
    transform: scale(1) !important;
}

input[type="checkbox"]:checked,
.woocommerce input[type="checkbox"]:checked,
.et-db #et-boc input[type="checkbox"]:checked {
    background-color: var(--form-background, #fff) !important;
    background-image: none !important;
    border-color: currentColor !important;
}

input[type="checkbox"]:disabled {
    --form-control-color: var(--form-control-disabled);
    color: var(--form-control-disabled);
    cursor: not-allowed;
}

/* ── Checkbox check animation ── */
@keyframes checkboxCheck {
    0%   { transform: scale(0); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ── Label layout for checkboxes ── */
.form-control,
label:has(> input[type="checkbox"]),
.woocommerce label:has(> input[type="checkbox"]),
.woocommerce form .form-row label:has(> input[type="checkbox"]),
#ship-to-different-address label:has(> input[type="checkbox"]),
.woocommerce-form__label-for-checkbox {
    line-height: 1.1;
    display: grid !important;
    grid-template-columns: 1em auto;
    gap: 0.5em;
    cursor: pointer;
    align-items: center;
}

.form-control + .form-control {
    margin-top: 1em;
}

.form-control--disabled {
    color: var(--form-control-disabled);
    cursor: not-allowed;
}

/* ── CF7: checkbox/acceptance wrapper fixes ── */
.wpcf7-list-item,
.wpcf7-form-control-wrap,
.wpcf7-acceptance {
    display: block !important;
    width: 100%;
}

.wpcf7-list-item {
    padding-top: 25px !important;
}

.wpcf7-list-item label {
    line-height: 1.4;
    display: grid;
    gap: 0.5em;
    align-items: start;
    cursor: pointer;
    padding-bottom: 30px !important;
}

/* ── File input button (::file-selector-button) ── */
input::file-selector-button {
    color: #fff;
    padding: 10px 30px;
    border: none;
    border-radius: 9px;
    margin-bottom: 6px;
    letter-spacing: 2px;
    font-size: 19px;
    font-family: 'Rubik', Helvetica, Arial, Lucida, sans-serif;
    text-transform: uppercase;
    background: #fb471f;
    font-weight: 300;
    cursor: pointer;
    transition: all 300ms ease 0ms;
}

input::file-selector-button:hover {
    background: #ca270b;
}

.dsm_contact_form_7_0 .wpcf7-form-control.wpcf7-file {
    padding-top: 25px !important;
}

/* ── Accessibility ── */
@media (prefers-reduced-motion: reduce) {
    input[type="checkbox"]::before {
        transition: none !important;
        animation: none !important;
    }

    .file-input-label {
        transition: none !important;
    }
}

@media (prefers-contrast: high) {
    input[type="checkbox"] {
        border-width: 0.2em;
    }

    .file-input-label {
        border: 2px solid currentColor;
    }
}
