/**
 * Modern Form Styling
 * Shared CSS for consistent form design across the application
 * Based on the job form's modern design pattern
 */

/* Modern Form Container */
.modern-form {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Form Card Styling */
.form-card {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 1.75rem 2rem;
    border: 1px solid #F1F5F9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    margin-bottom: 1.5rem;
}

/* Section Title with Icon */
.form-section-title {
    font-size: var(--font-size-md);
    font-weight: 700;
    color: #1E293B;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-section-title .section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-md);
}

/* Section Icon Color Variants */
.form-section-title .section-icon.blue { background: #EEF2FF; color: #4F46E5; }
.form-section-title .section-icon.purple { background: #F3E8FF; color: #9333EA; }
.form-section-title .section-icon.green { background: #ECFDF5; color: #059669; }
.form-section-title .section-icon.orange { background: #FFF7ED; color: #EA580C; }
.form-section-title .section-icon.red { background: #FEF2F2; color: #DC2626; }
.form-section-title .section-icon.teal { background: #F0FDFA; color: #0D9488; }
.form-section-title .section-icon.cyan { background: #ECFEFF; color: #0891B2; }
.form-section-title .section-icon.amber { background: #FFFBEB; color: #D97706; }
.form-section-title .section-icon.indigo { background: #EEF2FF; color: #4F46E5; }
.form-section-title .section-icon.pink { background: #FDF2F8; color: #DB2777; }

/* Modern Form Inputs */
.modern-form .form-control,
.modern-form .form-select {
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    padding: 0.75rem 1rem;
    font-size: var(--font-size-md);
    transition: all 0.2s ease;
    background-color: #FFFFFF;
    height: auto;
}

.modern-form .form-control:focus,
.modern-form .form-select:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.modern-form .form-control::placeholder {
    color: #94A3B8;
}

/* Modern Labels */
.modern-form .control-label,
.modern-form label:not(.form-check-label) {
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.625rem;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Valid state — green border on blur when field passes validation */
.modern-form .form-control.is-valid,
.modern-form .form-select.is-valid {
    border-color: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

/* Select2 Styling */
.modern-form .select2-container--bootstrap-5 .select2-selection {
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    padding: 0.5rem 0.75rem;
    min-height: 46px;
}

.modern-form .select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Field Groups */
.field-group {
    margin-bottom: 1.25rem;
}

/* Info Panels */
.info-panel {
    background: #F8FAFC;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    border: 1px solid #E2E8F0;
}

.info-panel .badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
    font-size: var(--font-size-sm);
}

/* Checkbox Styling */
.modern-form .form-check {
    padding-left: 1.75rem;
}

.modern-form .form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.15rem;
    border-radius: 4px;
    border: 1.5px solid #CBD5E1;
}

.modern-form .form-check-input:checked {
    background-color: #3B82F6;
    border-color: #3B82F6;
}

.modern-form .form-check-label {
    font-weight: 500;
    color: #334155;
    font-size: var(--font-size-base);
    text-transform: none;
    letter-spacing: normal;
}

/* Radio Button Styling */
.modern-form .form-check-input[type="radio"] {
    border-radius: 50%;
}

/* Action Buttons */
.form-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    padding: 0;
    margin: 0;
}

.form-actions .btn {
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    font-size: var(--font-size-base);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.form-actions .btn-primary {
    background: #3B82F6;
    border-color: #3B82F6;
}

.form-actions .btn-primary:hover {
    background: #2563EB;
    border-color: #2563EB;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.form-actions .btn-success {
    background: #059669;
    border-color: #059669;
}

.form-actions .btn-success:hover {
    background: #047857;
    border-color: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.3);
}

.form-actions .btn-secondary {
    background: #F1F5F9;
    border-color: #E2E8F0;
    color: #475569;
}

.form-actions .btn-secondary:hover {
    background: #E2E8F0;
    border-color: #CBD5E1;
    color: #334155;
}

.form-actions .btn-danger {
    background: #DC2626;
    border-color: #DC2626;
}

.form-actions .btn-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3);
}

/* Alert Styling */
.modern-form .alert {
    border-radius: 10px;
    border: none;
}

.modern-form .alert-danger {
    background: #FEF2F2;
    color: #991B1B;
}

.modern-form .alert-success {
    background: #ECFDF5;
    color: #065F46;
}

.modern-form .alert-warning {
    background: #FFFBEB;
    color: #92400E;
}

.modern-form .alert-info {
    background: #EFF6FF;
    color: #1E40AF;
}

/* Callout Styling */
.modern-form .callout {
    border-radius: 10px;
    border-left-width: 4px;
    padding: 1rem 1.25rem;
}

.modern-form .callout-info {
    background: #EFF6FF;
    border-color: #3B82F6;
}

.modern-form .callout-warning {
    background: #FFFBEB;
    border-color: #F59E0B;
}

.modern-form .callout-danger {
    background: #FEF2F2;
    border-color: #EF4444;
}

.modern-form .callout-success {
    background: #ECFDF5;
    border-color: #10B981;
}

/* Responsive Grid */
@media (max-width: 768px) {
    .form-card {
        padding: 1.25rem;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* Read-only display styling */
.form-control-plaintext {
    padding: 0.75rem 0;
    color: #334155;
}

/* Date inputs */
.modern-form input[type="date"] {
    cursor: pointer;
}

/* Textarea */
.modern-form textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Invalid state */
.modern-form .form-control.is-invalid,
.modern-form .form-select.is-invalid {
    border-color: #EF4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.modern-form .invalid-feedback {
    color: #DC2626;
    font-size: var(--font-size-sm);
    margin-top: 0.375rem;
}

/* Input Groups */
.modern-form .input-group .form-control {
    border-radius: 8px;
}

.modern-form .input-group .input-group-text {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    color: #64748B;
}

.modern-form .input-group > .form-control:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.modern-form .input-group > .form-control:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.modern-form .input-group > .input-group-text:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.modern-form .input-group > .input-group-text:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* File Upload Styling */
.modern-form .form-control[type="file"] {
    padding: 0.5rem 1rem;
}

.modern-form .form-control[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    margin-right: 1rem;
    border-radius: 6px;
    border: none;
    background: #3B82F6;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.modern-form .form-control[type="file"]::file-selector-button:hover {
    background: #2563EB;
}

/* Status Badge Inside Forms */
.modern-form .status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: var(--font-size-sm);
    font-weight: 600;
}

/* Divider */
.modern-form .form-divider {
    border-top: 1px solid #E2E8F0;
    margin: 1.5rem 0;
}

/* Help Text */
.modern-form .form-text {
    color: #64748B;
    font-size: var(--font-size-sm);
    margin-top: 0.375rem;
}

/* Required Field Indicator */
.modern-form .required::after {
    content: " *";
    color: #DC2626;
}

/* Disabled State */
.modern-form .form-control:disabled,
.modern-form .form-select:disabled {
    background-color: #F8FAFC;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Loading Spinner Inside Form */
.modern-form .spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Tooltip Trigger */
.modern-form .info-tooltip {
    cursor: help;
    color: #64748B;
    margin-left: 0.5rem;
}

.modern-form .info-tooltip:hover {
    color: #3B82F6;
}
