:root {
    --hfe-error-color: #e04848;
}

/*
 * .hfe-field-wrap replaces the field in whatever layout it used to sit in
 * (see the big comment in validation.js for why). It must never add its
 * own visual box - it should be invisible until an error needs to render
 * inside it - so it only ever changes size, never appearance.
 */
.hfe-field-wrap {
    display: block;
    min-width: 0; /* never lets the wrapper force its grid track wider than the field itself needs */
}

.hfe-invalid {
    border-color: var(--hfe-error-color) !important;
    background-color: rgba(224, 72, 72, .05) !important;
    background-color: color-mix(in srgb, var(--hfe-error-color) 6%, white) !important;
}

@keyframes hfe-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

.hfe-shake {
    animation: hfe-shake .4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes hfe-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/*
 * The error itself. No position:absolute/fixed anywhere here on purpose -
 * it is a normal block box, inserted right before its field inside
 * .hfe-field-wrap, so it renders directly above that field through plain
 * document flow. That means it can never drift out of place, never needs
 * recalculating on scroll/resize, and is completely unaffected by
 * page/object caching (LiteSpeed, Hostinger, etc.) since nothing about it
 * depends on server-side or per-request state.
 */
.hfe-error-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px;
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(224, 72, 72, .08);
    background: color-mix(in srgb, var(--hfe-error-color) 8%, white);
    border: 1px solid rgba(224, 72, 72, .25);
    border-color: color-mix(in srgb, var(--hfe-error-color) 28%, white);
    color: var(--hfe-error-color);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.4;
    animation: hfe-fade-in .18s ease-out;
}

.hfe-error-msg::before {
    content: '!';
    flex: 0 0 15px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--hfe-error-color);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
}
