/* ========================================
   PROFESSIONAL FORM STYLING
   ======================================== */

/* Form Container Enhancements */
.form-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Enhanced Form Controls */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-control:focus,
.form-select:focus {
    background: #ffffff;
    border-color: #020486;
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.05),
        0 0 0 3px rgba(2, 4, 134, 0.1);
    outline: none;
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Floating Labels Enhancement */
.form-floating {
    position: relative;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: #020486;
    font-weight: 600;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

.form-floating > label {
    color: #6b7280;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* Form Labels */
.form-label {
    color: #374151;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.form-label.required::after {
    content: ' *';
    color: #ef4444;
    font-weight: 700;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group-inline {
    display: flex;
    gap: 1rem;
    align-items: end;
}

/* Input Groups */
.input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group > .form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group-text {
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    color: #6b7280;
    font-weight: 600;
    padding: 0.875rem 1.25rem;
}

.input-group > .form-control:focus {
    z-index: 5;
}

/* Validation States */
.form-control.is-valid {
    border-color: #10b981;
    background-image: none;
}

.form-control.is-valid:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-control.is-invalid {
    border-color: #ef4444;
    background-image: none;
}

.form-control.is-invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.valid-feedback {
    color: #065f46;
    font-weight: 500;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
}

.valid-feedback::before {
    content: '?';
    color: #10b981;
    font-weight: 700;
    margin-right: 0.5rem;
}

.invalid-feedback,
.text-danger {
    color: #dc2626;
    font-weight: 500;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
}

/* Only show exclamation icon when there's actual error content */
.invalid-feedback:not(:empty)::before,
.text-danger:not(:empty)::before {
    content: '!';
    color: #ef4444;
    font-weight: 700;
    margin-right: 0.5rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fecaca;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Checkboxes and Radios */
.form-check {
    padding-left: 1.75rem;
    margin-bottom: 1rem;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: -1.75rem;
    border: 2px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: #ffffff;
    transition: all 0.3s ease;
}

.form-check-input:checked {
    background-color: #020486;
    border-color: #020486;
    box-shadow: 0 0 0 3px rgba(2, 4, 134, 0.1);
}

.form-check-input:focus {
    border-color: #020486;
    box-shadow: 0 0 0 3px rgba(2, 4, 134, 0.1);
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-label {
    color: #374151;
    font-weight: 500;
    cursor: pointer;
}

/* Form Buttons */
.form-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.form-buttons .btn {
    min-width: 120px;
}

/* Multi-step Forms */
.form-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.form-steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #e5e7eb;
    z-index: 1;
}

.form-step {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #6b7280;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.form-step.active {
    background: #020486;
    border-color: #020486;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(2, 4, 134, 0.1);
}

.form-step.completed {
    background: #10b981;
    border-color: #10b981;
    color: #ffffff;
}

.form-step.completed::after {
    content: '?';
}

/* Search Inputs */
.search-input {
    position: relative;
}

.search-input .form-control {
    padding-left: 3rem;
}

.search-input::before {
    content: '??';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    color: #6b7280;
}

/* File Uploads */
.file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    background: #f9fafb;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload:hover .file-upload-label,
.file-upload-label.dragover {
    border-color: #020486;
    background: #f0f2ff;
    color: #020486;
}

.file-upload-icon {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

/* Form Validation Summary */
.validation-summary {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.validation-summary h6 {
    color: #dc2626;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.validation-summary ul {
    margin: 0;
    padding-left: 1.5rem;
    color: #991b1b;
}

.validation-summary li {
    margin-bottom: 0.25rem;
}

/* Loading States for Forms */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2rem;
    height: 2rem;
    border: 3px solid #e5e7eb;
    border-top-color: #020486;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 10;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Responsive Form Design */
@media (max-width: 768px) {
    .form-container {
        padding: 1.5rem;
        border-radius: 1rem;
    }
    
    .form-buttons {
        flex-direction: column;
    }
    
    .form-buttons .btn {
        width: 100%;
    }
    
    .form-group-inline {
        flex-direction: column;
        gap: 0;
    }
    
    .form-steps {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .form-step {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .form-container {
        padding: 1rem;
        margin: 1rem;
    }
    
    .form-control,
    .form-select {
        padding: 0.75rem 1rem;
    }
    
    .file-upload-label {
        padding: 2rem 1rem;
    }
}