/* Shared validation styling. Neutral red that reads on both dark and light themes.
   A theme can override .FieldError / .FieldInvalid in its own custom.css. */
.FieldInvalid {
    border-color: #e04343 !important;
    box-shadow: 0 0 0 2px rgba(224, 67, 67, 0.18) !important;
}

.FieldErrorHost {
    position: relative;
}

/* Tooltip, not a block: it is taken out of flow so showing or hiding an error
   never moves the fields around it. */
.FieldError {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    z-index: 30;
    max-width: 100%;
    padding: 5px 10px 5px 27px;
    background: #2a1519;
    border: 1px solid #e04343;
    border-radius: 8px;
    color: #ffb3b3;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    white-space: nowrap;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
    /* it can be clicked away - form-validate.js hangs the handler on it */
    pointer-events: auto;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23e04343'%3E%3Cpath d='M8 1.5 15 14H1L8 1.5zm0 4.2a.8.8 0 0 0-.8.85l.2 3.1a.6.6 0 0 0 1.2 0l.2-3.1A.8.8 0 0 0 8 5.7zm0 5.2a.85.85 0 1 0 0 1.7.85.85 0 0 0 0-1.7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 9px center;
    background-size: 12px 12px;
    animation: FieldErrorIn 0.16s ease-out;
}

@keyframes FieldErrorIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.FieldError::before {
    content: "";
    position: absolute;
    top: -5px;
    right: 14px;
    width: 8px;
    height: 8px;
    background: inherit;
    border-left: 1px solid #e04343;
    border-top: 1px solid #e04343;
    transform: rotate(45deg);
}

/* The server-error summary is a real block at the top of the form. */
.FormServerError {
    margin-bottom: 14px;
}

.FormServerError .FieldError {
    position: static;
    max-width: none;
    margin-bottom: 6px;
    white-space: normal;
    font-size: 13px;
    box-shadow: none;
}

.FormServerError .FieldError::before {
    display: none;
}

/* The visible box is the label's ::before - the input itself is hidden. */
.CheckMaterial.FieldInvalid ~ .CheckboxLabel:before,
input[type="checkbox"].FieldInvalid + label:before {
    border-color: #e04343 !important;
    box-shadow: 0 0 0 2px rgba(224, 67, 67, 0.18);
}

/* A checkbox message keeps the theme's own placement - it is only the row that
   is widened, in the themes that box these into a half column, so that "right
   edge of the row" is the edge of the card. */
