/* Standardized Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color, #1e293b);
    font-size: 0.95rem;
}

.form-group label.required::after {
    content: "*";
    color: var(--danger-color, #ef4444);
    margin-left: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--input-bg, #f9fafb);
    color: var(--text-color, #1e293b);
    transition: all 0.3s ease;
}

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

.form-control::placeholder {
    color: var(--text-muted, #9ca3af);
}

.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--surface-secondary, #f3f4f6);
}

/* Form Validation States */
.form-control.is-valid {
    border-color: var(--success-color, #10b981);
}

.form-control.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger-color, #ef4444);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.invalid-feedback {
    display: block;
    color: var(--danger-color, #ef4444);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.valid-feedback {
    display: block;
    color: var(--success-color, #10b981);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Form Text */
.form-text {
    display: block;
    color: var(--text-muted, #6b7280);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Form Layout */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.form-col {
    flex: 1;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    min-width: 0;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
}

/* Custom Select */
.custom-select {
    position: relative;
    display: block;
    width: 100%;
}

.custom-select select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--input-bg, #f9fafb);
    color: var(--text-color, #1e293b);
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-select::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--text-secondary, #64748b);
    pointer-events: none;
}

.custom-select select:focus {
    outline: none;
    border-color: var(--accent-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Custom Checkbox */
.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 4px;
    background: var(--input-bg, #f9fafb);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.custom-checkbox input[type="checkbox"]:checked + .checkbox-indicator {
    background: var(--accent-color, #3b82f6);
    border-color: var(--accent-color, #3b82f6);
}

.custom-checkbox input[type="checkbox"]:checked + .checkbox-indicator::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.custom-checkbox input[type="checkbox"]:focus + .checkbox-indicator {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Custom Radio */
.custom-radio {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.custom-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 50%;
    background: var(--input-bg, #f9fafb);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.custom-radio input[type="radio"]:checked + .radio-indicator::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-color, #3b82f6);
}

.custom-radio input[type="radio"]:focus + .radio-indicator {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Custom Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color, #e2e8f0);
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color, #3b82f6);
}

input:focus + .slider {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Input with Icon */
.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #64748b);
    pointer-events: none;
}

.input-icon-left {
    left: 1rem;
}

.input-icon-right {
    right: 1rem;
}

.input-with-icon-left {
    padding-left: 2.5rem;
}

.input-with-icon-right {
    padding-right: 2.5rem;
}

/* Dark Mode Form Styles */
.dark-mode .form-group label {
    color: var(--text-color, #f1f5f9);
}

.dark-mode .form-control {
    background: var(--input-bg, #334155);
    border-color: var(--border-color, #475569);
    color: var(--text-color, #f1f5f9);
}

.dark-mode .form-control::placeholder {
    color: var(--text-muted, #94a3b8);
}

.dark-mode .form-control:disabled {
    background: var(--surface-secondary, #1e293b);
}

.dark-mode .form-text {
    color: var(--text-muted, #94a3b8);
}

.dark-mode .form-actions {
    border-top-color: var(--border-color, #475569);
}

.dark-mode .custom-select select {
    background: var(--input-bg, #334155);
    border-color: var(--border-color, #475569);
    color: var(--text-color, #f1f5f9);
}

.dark-mode .checkbox-indicator,
.dark-mode .radio-indicator {
    background: var(--input-bg, #334155);
    border-color: var(--border-color, #475569);
}

.dark-mode .slider {
    background-color: var(--border-color, #475569);
}

/* Responsive Form Styles */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .form-col {
        padding: 0;
        margin-bottom: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .form-control,
    .custom-select select,
    .checkbox-indicator,
    .radio-indicator,
    .slider,
    .slider:before {
        transition: none !important;
    }
}
