/**
 * Input Restrictions Styles
 * 
 * CSS for character counters, input validation feedback,
 * and visual indicators for XI Class Admission Payment Form
 */

/* Character Counter Styles */
.char-counter {
    position: absolute;
    right: 10px;
    bottom: -20px;
    font-size: 12px;
    color: #6c757d;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    display: none;
    transition: all 0.3s ease;
    z-index: 10;
    pointer-events: none;
    /* Make sure counter doesn't interfere with input interactions */
}

/* Styling for inputs with few characters left */
.characters-left-few {
    border-color: #ffc107 !important;
}

.characters-left-few+.char-counter {
    color: #856404;
    background-color: rgba(255, 243, 205, 0.9);
    font-weight: bold;
}

/* Input validation visual feedback */
.input-invalid-char {
    animation: pulse-error 0.3s ease;
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05);
}

@keyframes pulse-error {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Error message animation */
.shake-error {
    animation: shake 0.5s ease-in-out;
    border-color: #dc3545 !important;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-5px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-3px);
    }

    80% {
        transform: translateX(3px);
    }

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

/* Remove spinners/arrows from number inputs */
/* For Chrome, Safari, Edge */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* For Firefox */
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Focus state for inputs */
input:focus-visible {
    outline: 2px solid #86b7fe;
    outline-offset: -1px;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Error state for inputs */
.form-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 5px;
    display: none;
    transition: all 0.3s ease;
}

/* Showing error messages */
.form-error.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .char-counter {
        bottom: -18px;
        font-size: 10px;
        right: 5px;
    }
}