/* Form Styles */

.form-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    padding: 12px;
    margin-bottom: 10px;
}

.form-header {
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f8f9fa;
}

.form-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.form-subtitle {
    color: #6c757d;
    font-size: 0.8rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 8px;
}

.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
    display: block;
    font-size: 11px;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-color);
}

/* Input Styles */
.form-control {
    border-radius: 6px;
    border: 2px solid #e9ecef;
    padding: 6px 8px;
    font-size: 11px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 1);
}

/* Input Groups */
.input-group {
    position: relative;
}

.input-group-text {
    border-radius: 6px 0 0 6px;
    border: 2px solid #e9ecef;
    border-right: none;
    background: rgba(248, 249, 250, 0.9);
    color: #6c757d;
    padding: 6px 8px;
}

.input-group .form-control {
    border-left: none;
    border-radius: 0 6px 6px 0;
}

.input-group .form-control:focus+.input-group-text,
.input-group .form-control:focus {
    border-color: var(--primary-color);
}

.input-group .form-control.is-invalid {
    border-color: #dc3545;
}

.input-group .form-control.is-valid {
    border-color: #28a745;
}

/* Select Styles */
.form-select {
    border-radius: 6px;
    border: 2px solid #e9ecef;
    padding: 6px 8px;
    font-size: 11px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px 8px;
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
}

/* Textarea Styles */
.form-control[rows] {
    min-height: 60px;
    resize: vertical;
}

/* File Input */
.form-control[type="file"] {
    padding: 6px 8px;
    background: rgba(248, 249, 250, 0.9);
}

.form-control[type="file"]::-webkit-file-upload-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 4px;
    color: white;
    padding: 4px 8px;
    font-weight: 600;
    margin-right: 6px;
    transition: all 0.3s ease;
    font-size: 10px;
}

.form-control[type="file"]::-webkit-file-upload-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

/* Checkbox and Radio */
.form-check {
    margin-bottom: 6px;
}

.form-check-input {
    border-radius: 3px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-check-label {
    font-weight: 500;
    color: #333;
    margin-left: 4px;
    font-size: 11px;
}

/* Validation Feedback */
.invalid-feedback {
    display: block !important;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
    font-weight: 500;
}

.valid-feedback {
    display: block !important;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #28a745;
    font-weight: 500;
}

/* Enhanced validation styling */
.form-control.is-invalid:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.form-control.is-valid:focus {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Error icon styling */
.form-control.is-invalid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='m5.8 4.6 2.4 2.4m0-2.4L5.8 7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.is-valid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94 2.78 2.78 2.78-2.78.94.94L5.02 9.5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

/* Ensure validation messages are visible */
.invalid-feedback {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Additional validation styling for better visibility */
.form-control.is-invalid {
    border-width: 2px !important;
    border-style: solid !important;
    border-color: #dc3545 !important;
}

.form-control.is-valid {
    border-width: 2px !important;
    border-style: solid !important;
    border-color: #28a745 !important;
}

/* Force validation message display */
.error {
    color: #dc3545 !important;
    font-size: 0.875em !important;
    font-weight: 500 !important;
    margin-top: 0.25rem !important;
    display: block !important;
}

/* Form Buttons */
.form-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #f8f9fa;
}

.form-btn {
    border-radius: 6px;
    padding: 6px 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    font-size: 11px;
}

.form-btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.form-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    color: white;
}

.form-btn-secondary {
    background: transparent;
    border: 2px solid #6c757d;
    color: #6c757d;
}

.form-btn-secondary:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-1px);
}

.form-btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #e74c3c 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.2);
}

.form-btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    color: white;
}

/* Form Grid */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

/* Form Sections */
.form-section {
    background: rgba(248, 249, 250, 0.5);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
}

.form-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--primary-color);
}

/* Form Help Text */
.form-text {
    font-size: 9px;
    color: #6c757d;
    margin-top: 2px;
}

/* Form Loading State */
.form-loading {
    opacity: 0.6;
    pointer-events: none;
}

.form-loading .btn {
    position: relative;
}

.form-loading .btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive Forms */
@media (max-width: 768px) {
    .form-container {
        padding: 8px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-buttons {
        flex-direction: column;
    }

    .form-btn {
        width: 100%;
        margin-bottom: 6px;
    }
}

/* Form Success/Error States */
.form-success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(32, 201, 151, 0.1) 100%);
    border: 1px solid var(--success-color);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

.form-error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(231, 76, 60, 0.1) 100%);
    border: 1px solid var(--danger-color);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

/* Simple Validation Styling */
.field-error {
    border: 2px solid #dc3545 !important;
    background-color: #fff5f5 !important;
}

.validation-error {
    color: #dc3545 !important;
    font-size: 0.875em !important;
    font-weight: 500 !important;
    margin-top: 0.25rem !important;
    display: block !important;
}

/* Remove all complex validation styling */
.form-control.is-invalid,
.form-control.is-valid,
.form-control.is-invalid:focus,
.form-control.is-valid:focus {
    box-shadow: none !important;
    background-image: none !important;
    padding-right: 8px !important;
}

/* Remove Bootstrap validation classes */
.invalid-feedback,
.valid-feedback {
    display: none !important;
}