/*
 * Form styles — loaded after the theme (style.css).
 * Field errors and checkboxes, shared by register, login, profile,
 * contact and checkout forms.
 */

/* -------------------------------------------------------------------------
 * Field errors
 * ---------------------------------------------------------------------- */

/* <x-input-error> */
.input-error {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    color: var(--secondary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.input-error li + li {
    margin-top: 2px;
}

/* <x-front.forms.field-error> */
.error.d__flex {
    gap: 4px;
    margin-top: 6px;
    color: var(--secondary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.error.d__flex .material-symbols-outlined {
    font-size: 18px;
}

/* Red outline on the field that has the error (theme inputs have no border) */
.form-control.is-invalid,
.form-select.is-invalid,
div:has(> .input-error) .form-control,
div:has(> .input-error) .form-select,
div:has(> .error.d__flex) .form-control,
div:has(> .error.d__flex) .form-select {
    box-shadow: inset 0 0 0 1.5px var(--secondary);
}

/* -------------------------------------------------------------------------
 * Selects — same look as the theme's .form-control
 * ---------------------------------------------------------------------- */

.form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%232e2e2e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    height: 50px;
    padding: 10px 48px 10px 20px;
    border: 0;
    border-radius: var(--bs-border-radius);
    background-color: var(--light);
    background-position: right 18px center;
    background-size: 18px 18px;
    font-size: 16px;
    color: black;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

/* Same spacing as text inputs (.input-group has margin-bottom: 20px) */
.register-fields .form-select {
    margin-bottom: 20px;
}

.form-select:focus {
    background-color: #f3f3f3;
    box-shadow: none;
}

.form-select:disabled {
    background-color: var(--light);
    color: #8a8a8a;
    opacity: 0.6;
    cursor: not-allowed;
}

/* Read-only, autofilled fields (e.g. county) */
.form-control[readonly] {
    color: #555;
    cursor: not-allowed;
}

.form-control[readonly]:focus {
    background: var(--light);
}

/* -------------------------------------------------------------------------
 * Label with an info icon (native tooltip via title)
 * ---------------------------------------------------------------------- */

/* The label's bottom margin (.form-label: 15px) moves to the wrapper,
   so label and icon centre on each other */
.label-with-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
}

.label-with-info .form-label {
    margin-bottom: 0;
}

.field-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 18px;
    line-height: 1;
    color: #9a9a9a;
    cursor: help;
}

.field-info:hover {
    color: var(--primary-dark);
}

/* -------------------------------------------------------------------------
 * Checkboxes  (.checkbox-body > input[type=checkbox] + label)
 * ---------------------------------------------------------------------- */

.checkbox-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.checkbox-body input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 20px;
    display: grid;
    place-content: center;
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    border: 1.5px solid #c4c4c4;
    border-radius: 5px;
    background-color: #fff;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Check mark */
.checkbox-body input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 5px;
    margin-top: -3px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) scale(0);
    transition: transform 0.15s ease;
}

.checkbox-body input[type="checkbox"]:hover {
    border-color: var(--primary-dark);
}

.checkbox-body input[type="checkbox"]:checked {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.checkbox-body input[type="checkbox"]:checked::before {
    transform: rotate(-45deg) scale(1);
}

.checkbox-body input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary);
}

.checkbox-body input[type="checkbox"].is-invalid,
.checkbox-body:has(+ .input-error) input[type="checkbox"],
.checkbox-body:has(+ .error.d__flex) input[type="checkbox"] {
    border-color: var(--secondary);
}

.checkbox-body input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkbox-body label {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
    user-select: none;
}

.checkbox-body label a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.checkbox-body label a:hover {
    color: var(--secondary);
}
