/* Form validation styles */
.form-control-validation {
    position: relative;
}

.invalid-feedback {
    display: none;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

.is-invalid {
    border-color: #dc3545 !important;
}

.is-valid {
    border-color: #198754 !important;
}

/* Animation for validation errors */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

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

/* Accessibility improvements */
[aria-invalid="true"] {
    outline: 2px solid #dc3545;
}

/* Custom validation styles for payment options */
.payment-card.invalid {
    border: 1px solid #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Input restrictions visual feedback */
input.characters-left-few {
    background-color: transparent;
}

/* Prevent number input spinners */
input[type="text"][inputmode="numeric"] {
    -moz-appearance: textfield;
    /* Firefox */
}

input[type="text"][inputmode="numeric"]::-webkit-outer-spin-button,
input[type="text"][inputmode="numeric"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Character counter styles */
.char-counter {
    position: absolute;
    right: 10px;
    bottom: -20px;
    font-size: 0.75rem;
    color: #6c757d;
    pointer-events: none;
}

/* Input focus highlight for numeric fields */
input[type="text"][inputmode="numeric"]:focus {
    background-color: transparent;
    transition: background-color 0.3s;
}

/* Invalid character highlight animation */
@keyframes invalidChar {
    0% {
        background-color: #fff;
    }

    50% {
        background-color: rgba(255, 220, 220, 0.7);
    }

    100% {
        background-color: #fff;
    }
}

.input-invalid-char {
    animation: invalidChar 0.3s forwards;
}