/* 
 * Campus Lane Holdings - Form Improvements
 * Enhanced user-friendly form styles
 */

/* ===========================
   BETTER INPUT FOCUS STYLES
   =========================== */
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 124, 0.1);
    transform: none !important;
}

/* Remove aggressive animations */
.form-control-animated {
    animation: none !important;
    transform: none !important;
}

/* ===========================
   FLOATING LABEL INPUTS (OPTIONAL ENHANCEMENT)
   =========================== */
.form-floating {
    position: relative;
}

.form-floating .form-control {
    padding: 20px 20px 8px 20px;
}

.form-floating label {
    position: absolute;
    top: 18px;
    left: 20px;
    color: var(--text-light);
    pointer-events: none;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.form-floating .form-control:focus ~ label,
.form-floating .form-control:not(:placeholder-shown) ~ label {
    top: 6px;
    font-size: 0.75rem;
    color: var(--primary-color);
}

/* ===========================
   INPUT WITH ICONS
   =========================== */
.input-with-icon {
    position: relative;
}

.input-with-icon .form-control {
    padding-left: 48px;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.1rem;
    pointer-events: none;
}

.input-with-icon .form-control:focus ~ .input-icon {
    color: var(--primary-color);
}

/* ===========================
   BETTER SELECT DROPDOWNS
   =========================== */
select.form-control {
    cursor: pointer;
    background-position: right 16px center;
    background-size: 14px;
}

select.form-control:hover {
    border-color: var(--primary-color);
}

/* ===========================
   SMOOTH CHECKBOX & RADIO
   =========================== */
.custom-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    cursor: pointer;
}

.custom-control input[type="checkbox"],
.custom-control input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* ===========================
   BETTER FILE INPUT
   =========================== */
.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper input[type="file"] {
    opacity: 0;
    position: absolute;
    z-index: -1;
}

.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 20px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-primary);
}

.file-input-label:hover {
    border-color: var(--primary-color);
    background: rgba(44, 95, 124, 0.05);
}

.file-input-label i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* ===========================
   FORM VALIDATION FEEDBACK
   =========================== */
.form-control.is-valid {
    border-color: var(--success);
}

.form-control.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.form-control.is-invalid {
    border-color: var(--error);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.valid-feedback,
.invalid-feedback {
    display: block;
    margin-top: 8px;
    font-size: 0.9rem;
}

.valid-feedback {
    color: var(--success);
}

.invalid-feedback {
    color: var(--error);
}

/* ===========================
   CHARACTER COUNTER
   =========================== */
.char-counter {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.char-counter.warning {
    color: var(--warning);
}

.char-counter.danger {
    color: var(--error);
}

/* ===========================
   BETTER FORM BUTTONS
   =========================== */
.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
    min-height: 56px;
}

.btn:active {
    transform: translateY(1px);
}

/* ===========================
   LOADING STATE FOR FORMS
   =========================== */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* ===========================
   RESPONSIVE FORM IMPROVEMENTS
   =========================== */
@media (max-width: 768px) {
    .form-control {
        min-height: 52px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    textarea.form-control {
        min-height: 140px;
    }
    
    .btn-large {
        padding: 14px 28px;
        min-height: 52px;
    }
}
